package com.tjtt.gwm.action;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;

import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.apache.struts2.ServletActionContext;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.tjtt.common.gps.BLH;
import com.tjtt.common.gps.CoordTranf;
import com.tjtt.common.gps.Four_Par;
import com.tjtt.common.gps.GpsUtil;
import com.tjtt.common.gps.xyh;
import com.tjtt.common.utils.TotalFlowXmlTool;
import com.tjtt.gwm.bean.Junyans;
import com.tjtt.gwm.bean.Junyansceshis;
import com.tjtt.gwm.bean.Junyansshejis;
import com.tjtt.gwm.service.DbService;
import com.tjtt.gwm.service.EquipmentService;

import com.tjtt.gwm.service.JunyansService;
import com.tjtt.gwm.service.PipePointService;
import com.tjtt.tdm.base.BaseAction;
import com.tjtt.tdm.base.PageResult;
import com.tjtt.tdm.base.StringUtil;
import com.tjtt.tdm.codeReview.service.ICodeReviewService;
import com.tjtt.tdm.flow.bean.FlowDetailed;
import com.tjtt.tdm.flow.service.IFlowformService;
import com.tjtt.tdm.form.bean.AutoFormsNew;
import com.tjtt.tdm.util.PubMethod;
import com.tjtt.tdm.util.WordTool;

public class updateDataAction extends BaseAction {

	private DbService dbService;
	private List<Object[]> pipeSecStructList; // 管段数组
	private List<Object[]> pipeSecStructListTee; // 含三叉点的管段数组
	private List<List<Object[]>> pipeSecStructListSorted;
	private List<Object[]> pipeLineNodeList;
	int m_num3;
	int m_num1;
	int m_num2;

	public DbService getDbService() {
		return dbService;
	}

	public void setDbService(DbService dbService) {
		this.dbService = dbService;
	}

	public void searchshijiandw() throws IOException {
		String jingdu = getRequest().getParameter("jingdu");
		String weidu = getRequest().getParameter("weidu");
		String zuobiaox = getRequest().getParameter("zuobiaox");
		String zuobiaoy = getRequest().getParameter("zuobiaoy");
		// 坐标X、Y转换为经纬度
		if (jingdu.equals("") || weidu.equals("")) {
			CoordTranf coordTranf = new CoordTranf();
			Four_Par m4 = new Four_Par();// 这里定义的参数是从BL ---> xy的参数
			m4.dX = -4117827.9819;
			m4.dY = 87682.7697;
			m4.Cita = -0.41671168;// 这里输入单位应该是度，原来的-0.250016206100是dms单位
			m4.k = 0.999948651073;
			Double x = Double.parseDouble(zuobiaox);
			Double y = Double.parseDouble(zuobiaoy);
			xyh mxyh = new xyh();
			mxyh.x = x.doubleValue();// 单位米
			mxyh.y = y.doubleValue();// 单位米
			BLH mBL = coordTranf.XY2BL(mxyh, 117, m4);
			Double l = mBL.L;
			Double b = mBL.B;
			jingdu = l.toString();
			weidu = b.toString();
		}
		// 经纬度转换为地图经纬度
		GpsUtil gpsutil = new GpsUtil();
		BLH blh = gpsutil.ReDefineGps(jingdu, weidu);
		Double lmap = blh.L;
		Double bmap = blh.B;
		String strlmap = lmap.toString();
		String strbmap = bmap.toString();
		// 输出
		setContentType();
		PrintWriter out = getResponse().getWriter();
		try {
			JSONObject jsonobj = new JSONObject();
			jsonobj.put("longitude", strlmap);
			jsonobj.put("latitude", strbmap);
			out.print(jsonobj.toString());
			// out.print("{\"result\":\"success\"}");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			out.print("{\"result\":\"error\"}");
			e.printStackTrace();
		}
	}

	// 获取管段平面长度
	public double getPlaneLength(double y1, double y2, double x1, double x2) {
		double length = 0.0;
		length = Math.sqrt(Math.pow((y1 - y2), 2) + Math.pow((x1 - x2), 2));
		return length;
	}

	public double getRealLength(double y1, double y2, double x1, double x2,
			double h1, double h2) {
		double length = 0.0;
		length = Math.sqrt(Math.pow((y1 - y2), 2) + Math.pow((x1 - x2), 2)
				+ Math.pow((h1 - h2), 2));
		return length;
	}

	public int getMapLevel(double length) {
		// [19,20m];[18,50m];[17,100m];[16,200m];[15,500m];[14,1km];[13,2km]
		// [12,5km];[11,10km]
		int level = 0;
		if (length < 50) {
			level = 19;
		} else if (length < 100) {
			level = 18;
		} else if (length < 200) {
			level = 17;
		} else if (length < 500) {
			level = 16;
		} else if (length < 1000) {
			level = 15;
		} else if (length < 2000) {
			level = 14;
		} else if (length < 5000) {
			level = 13;
		}
		return level;
	}

	public void InitPipeStru(List list) {
		pipeSecStructList = new ArrayList();
		pipeSecStructListTee = new ArrayList();
		int size = list.size();
		for (int i = 0; i < size; i++) {
			int countS = 1;
			int countE = 1;
			Object[] objs = (Object[]) list.get(i);
			String strID = (String) objs[0]; // 管段编号
			double l1 = Double.parseDouble(objs[1].toString()); // 起点经度
			double l2 = Double.parseDouble(objs[2].toString()); // 终点经度
			double b1 = Double.parseDouble(objs[3].toString()); // 起点纬度
			double b2 = Double.parseDouble(objs[4].toString()); // 终点纬度

			Object[] objStruct = new Object[8];
			objStruct[0] = objs[0];// 管段编号
			objStruct[1] = objs[1];// 起点经度
			objStruct[2] = objs[2];// 终点经度
			objStruct[3] = objs[3];// 起点纬度
			objStruct[4] = objs[4];// 终点纬度
			objStruct[5] = 0; // 起点类型
			objStruct[6] = 0; // 终点类型
			objStruct[7] = false; // 是否已排序
			for (int j = 0; j < size; j++) {
				if (j == i) {
					continue;
				}
				Object[] objsTemp = (Object[]) list.get(j);
				String strIDTemp = (String) objs[0]; // 管段编号
				double l1Temp = Double.parseDouble(objsTemp[1].toString()); // 起点经度
				double l2Temp = Double.parseDouble(objsTemp[2].toString()); // 终点经度
				double b1Temp = Double.parseDouble(objsTemp[3].toString()); // 起点纬度
				double b2Temp = Double.parseDouble(objsTemp[4].toString()); // 终点纬度
				if (l1Temp == l1) {
					countS++;
				}
				if (l2Temp == l1) {
					countS++;
				}
				if (l1Temp == l2) {
					countE++;
				}
				if (l2Temp == l2) {
					countE++;
				}
			}
			objStruct[5] = countS; // 起点类型
			objStruct[6] = countE; // 终点类型
			pipeSecStructList.add(objStruct);
			if (countS > 2 || countE > 2) {
				pipeSecStructListTee.add(objStruct);
			}
		}
	}

	public void getNodeTypeNum() {
		int num3 = 0;
		int num1 = 0;
		int num2 = 0;
		int size = pipeSecStructList.size();
		for (int i = 0; i < size; i++) {
			Object[] objs = (Object[]) pipeSecStructList.get(i);
			// String strID=(String)objs[0]; //管段编号
			// double l1=Double.parseDouble(objs[1].toString()); //起点经度
			// double l2=Double.parseDouble(objs[2].toString()); //终点经度
			// double b1=Double.parseDouble(objs[3].toString()); //起点纬度
			// double b2=Double.parseDouble(objs[4].toString()); //终点纬度
			int sType = Integer.parseInt(objs[5].toString()); // 起点类型
			int eType = Integer.parseInt(objs[6].toString()); // 起点类型
			if (sType == 1) {
				num1++;
			}
			if (eType == 1) {
				num1++;
			} else if (sType == 2) {
				num2++;
			} else if (eType == 2) {
				num2++;
			} else if (sType > 2) {
				num3++;
			} else if (eType > 2) {
				num3++;
			}
		}
		m_num1 = num1;
		m_num2 = num2;
		m_num3 = num3;
	}

	public List<Object[]> SearchPipeSec(Object[] objsFirst, double latitude,
			Object[] objNode) {
		List<Object[]> result = new ArrayList<Object[]>();
		result.add(objsFirst);
		int num = pipeSecStructList.size();
		int type = 0;
		while (true) {
			int i;
			for (i = 0; i < num; i++) {
				Object[] objs = (Object[]) pipeSecStructList.get(i);
				// String strID=(String)objs[0]; //管段编号
				// if(strID.equals(strSkipID))
				// {
				// continue;
				// }
				double l1 = Double.parseDouble(objs[1].toString()); // 起点经度
				double l2 = Double.parseDouble(objs[2].toString()); // 终点经度
				double b1 = Double.parseDouble(objs[3].toString()); // 起点纬度
				double b2 = Double.parseDouble(objs[4].toString()); // 终点纬度
				int sType = Integer.parseInt(objs[5].toString()); // 起点类型
				int eType = Integer.parseInt(objs[6].toString()); // 终点类型
				boolean isSorted = Boolean.parseBoolean(objs[7].toString());
				if (isSorted == true) // 已排序
				{
					continue;
				}
				if (l1 == latitude) // 起点相等
				{
					latitude = l2;
					objs[7] = true; // 已排序
					result.add(objs);
					pipeSecStructList.set(i, objs);
					type = sType;
					// 节点赋值
					objNode[3] = l2; // 终点经度
					objNode[4] = b2; // 终点纬度
					break;
				}
				if (l2 == latitude) // 终点相等
				{
					latitude = l1;
					objs[7] = true; // 已排序
					result.add(objs);
					pipeSecStructList.set(i, objs);
					type = eType;
					// 节点赋值
					objNode[3] = l1; // 终点经度
					objNode[4] = b1; // 终点纬度
					break;
				}
			}
			if (type != 2 || i == num) {
				break;
			}
		}
		return result;
	}

	public void SortPipeSectionTee(String pipeLineNo) {
		int num = pipeSecStructList.size();
		for (int i = 0; i < num; i++) {
			Object[] objs = (Object[]) pipeSecStructList.get(i);
			String strID = (String) objs[0]; // 管段编号
			double l1 = Double.parseDouble(objs[1].toString()); // 起点经度
			double l2 = Double.parseDouble(objs[2].toString()); // 终点经度
			double b1 = Double.parseDouble(objs[3].toString()); // 起点纬度
			double b2 = Double.parseDouble(objs[4].toString()); // 终点纬度
			int sType = Integer.parseInt(objs[5].toString()); // 起点类型
			int eType = Integer.parseInt(objs[6].toString()); // 终点类型
			boolean isSorted = Boolean.parseBoolean(objs[7].toString());
			if (isSorted == true) // 已排序
			{
				continue;
			}
			if (sType < 3 && eType < 3) // 起点终点都不是三叉点
			{
				continue;
			}
			objs[7] = true; // 已排序
			pipeSecStructList.set(i, objs);
			if (sType > 2 && eType > 2) // 起点终点都为三叉点
			{
				List<Object[]> list = new ArrayList<Object[]>();
				list.add(objs);
				pipeSecStructListSorted.add(list);
				Object[] objNode = new Object[5];
				objNode[0] = pipeLineNo;
				objNode[1] = l1; // 起点经度
				objNode[2] = b1; // 起点纬度
				objNode[3] = l2; // 终点经度
				objNode[4] = b2; // 终点纬度
				pipeLineNodeList.add(objNode);
				continue;
			}
			if (sType > 2) // 起点为三叉点
			{
				Object[] objNode = new Object[5];
				objNode[0] = pipeLineNo;
				objNode[1] = l1; // 起点经度
				objNode[2] = b1; // 起点纬度
				objNode[3] = l2; // 终点经度
				objNode[4] = b2; // 终点纬度
				List<Object[]> list = SearchPipeSec(objs, l2, objNode);
				pipeSecStructListSorted.add(list);
				pipeLineNodeList.add(objNode);
			}
			if (eType > 2) // 终点为三叉点
			{
				Object[] objNode = new Object[5];
				objNode[0] = pipeLineNo;
				objNode[1] = l2;// 起点经度
				objNode[2] = b2;// 起点纬度
				objNode[3] = l1; // 终点经度
				objNode[4] = b1; // 终点纬度
				List<Object[]> list = SearchPipeSec(objs, l1, objNode);
				pipeSecStructListSorted.add(list);
				pipeLineNodeList.add(objNode);
			}
		}
	}

	public void SortPipeSection1(String pipeLineNo) {
		int num = pipeSecStructList.size();
		for (int i = 0; i < num; i++) {
			Object[] objs = (Object[]) pipeSecStructList.get(i);
			boolean isSorted = Boolean.parseBoolean(objs[7].toString());
			if (isSorted == true) {
				continue;
			}
			String strID = (String) objs[0]; // 管段编号
			double l1 = Double.parseDouble(objs[1].toString()); // 起点经度
			double l2 = Double.parseDouble(objs[2].toString()); // 终点经度
			double b1 = Double.parseDouble(objs[3].toString()); // 起点纬度
			double b2 = Double.parseDouble(objs[4].toString()); // 终点纬度
			int sType = Integer.parseInt(objs[5].toString()); // 起点类型
			int eType = Integer.parseInt(objs[6].toString()); // 终点类型
			if (sType != 1 && eType != 1) // 起点终点都不是断点
			{
				continue;
			}
			objs[7] = true; // 已排序
			pipeSecStructList.set(i, objs);
			if (sType == 1) // 起点为断点
			{
				Object[] objNode = new Object[5];
				objNode[0] = pipeLineNo;
				objNode[1] = l1; // 起点经度
				objNode[2] = b1; // 起点纬度
				objNode[3] = l2; // 终点经度
				objNode[4] = b2; // 终点纬度
				List<Object[]> list = SearchPipeSec(objs, l2, objNode);
				pipeSecStructListSorted.add(list);
				pipeLineNodeList.add(objNode);
			}
			if (eType == 1) // 终点为断点
			{
				Object[] objNode = new Object[5];
				objNode[0] = pipeLineNo;
				objNode[1] = l2; // 起点经度
				objNode[2] = b2; // 起点纬度
				objNode[3] = l1; // 终点经度
				objNode[4] = b1; // 终点纬度
				List<Object[]> list = SearchPipeSec(objs, l1, objNode);
				pipeSecStructListSorted.add(list);
				pipeLineNodeList.add(objNode);
			}
		}
	}

	public 	int SortPipeSection(String pipeLineNo) {
		String sql = "select t.id,t.beginnodeL,t.endnodeL,t.beginnodeB,t.endnodeB "
				+ "from ptem_pipesection t where t.pipelineno='"
				+ pipeLineNo
				+ "' order by beginnodel ";
		List list = dbService.queryDataBySql(sql);
		if(list.size()==0)
		{
			return -1;			
		}
		InitPipeStru(list);
		// getNodeTypeNum();
		pipeSecStructListSorted = new ArrayList<List<Object[]>>(); // 排序后的管段数组
		pipeLineNodeList = new ArrayList<Object[]>();
		SortPipeSectionTee(pipeLineNo);
		SortPipeSection1(pipeLineNo);
		int size = pipeLineNodeList.size();
		for (int i = 0; i < size; i++) {
			Object[] obj = pipeLineNodeList.get(i);
			String strBeginNodeL = obj[1].toString();
			String strBeginNodeB = obj[2].toString();
			String strEndNodeL = obj[3].toString();
			String strEndNodeB = obj[4].toString();
			String strId = "SEQ_PTEM_PIPELINE_NODE.nextval";
			String sqlInsert = "insert into PTEM_PIPELINE_NODE(ID,"
					+ "PIPELINENO,BEGINNODEL,BEGINNODEB,ENDNODEL,ENDNODEB)"
					+ "values(" + strId + ",'" + pipeLineNo + "',"
					+ strBeginNodeL + "," + strBeginNodeB + "," + strEndNodeL
					+ "," + strEndNodeB + ")";
			dbService.exeSql(sqlInsert);
		}
		return 0;
		//System.out.println("ok");
	}

	public void getNode(List list, double latitudeE, double longitudeE,
			List nodeList) {
		if (latitudeE == 116.77041264 || latitudeE == 116.77041092
				|| latitudeE == 116.77040983) {
			System.out.println("---");
			System.out.println(latitudeE);
			System.out.println("---");
		}
		List<Double> teeLatitudeEList = new ArrayList<Double>();
		List<Double> teeLongitudeEList = new ArrayList<Double>();
		List<Integer> teeIndex = new ArrayList<Integer>();
		int index = 0;
		int count = 0;
		do {
			count = 0;
			double latitudeETemp = latitudeE;
			double longitudeETemp = longitudeE;
			for (int i = 0; i < list.size(); i++) {
				Object[] objs = (Object[]) list.get(i);
				String strID = (String) objs[0];
				double l1 = Double.parseDouble(objs[1].toString()); // 起点经度
				double l2 = Double.parseDouble(objs[2].toString()); // 终点经度
				double b1 = Double.parseDouble(objs[3].toString()); // 起点纬度
				double b2 = Double.parseDouble(objs[4].toString()); // 终点纬度
				if (l1 == latitudeE) {
					if (count == 0) {
						latitudeETemp = l2;
						longitudeETemp = b2;
						index = i;
						list.remove(index);
						i--;
					} else {
						teeLatitudeEList.add(l2);
						teeLongitudeEList.add(b2);
						index = i;
						list.remove(index);
						i--;
						// nodeList.add(list.get(index));
						Object[] e = new Object[2];
						e[0] = latitudeE;
						e[1] = longitudeE;
						// nodeList.add(e);
						int size = nodeList.size();
						int k;
						for (k = 0; k < size; k++) {
							Object[] objsTemp = (Object[]) nodeList.get(k);
							double lTemp = Double.parseDouble(objsTemp[0]
									.toString()); // 起点经度
							if (lTemp == latitudeE) {
								break;
							}
						}
						if (k == size) {
							nodeList.add(e);
						}
					}
					count++;
				}
				if (l2 == latitudeE) {
					if (count == 0) {
						index = i;
						latitudeETemp = l1;
						longitudeETemp = b1;
						list.remove(index);
						i--;
					} else {
						teeLatitudeEList.add(l1);
						teeLongitudeEList.add(b1);
						index = i;
						list.remove(index);
						i--;
						Object[] e = new Object[2];
						e[0] = latitudeE;
						e[1] = longitudeE;
						int size = nodeList.size();
						int k;
						for (k = 0; k < size; k++) {
							Object[] objsTemp = (Object[]) nodeList.get(k);
							double lTemp = Double.parseDouble(objsTemp[0]
									.toString()); // 起点经度
							if (lTemp == latitudeE) {
								break;
							}
						}
						if (k == size) {
							nodeList.add(e);
						}
					}
					count++;
				}
			}
			latitudeE = latitudeETemp;
			longitudeE = longitudeETemp;
			if (latitudeE == 116.77041264 || latitudeE == 116.77041092
					|| latitudeE == 116.77040983) {
				System.out.println("---");
				System.out.println(latitudeE);
				System.out.println("---");
			}
		} while (count != 0);
		Object[] e = new Object[2];
		e[0] = latitudeE;
		e[1] = longitudeE;
		// nodeList.add(e);
		int size = nodeList.size();
		int k;
		for (k = 0; k < size; k++) {
			Object[] objsTemp = (Object[]) nodeList.get(k);
			double lTemp = Double.parseDouble(objsTemp[0].toString()); // 起点经度
			if (lTemp == latitudeE) {
				break;
			}
		}
		if (k == size) {
			nodeList.add(e);
		}
		int teeSize = teeLatitudeEList.size();
		for (int j = 0; j < teeSize; j++) {
			double LatitudeE = teeLatitudeEList.get(j);
			double LongitudeE = teeLongitudeEList.get(j);
			getNode(list, LatitudeE, LongitudeE, nodeList);
		}
	}

	public void updatePipeLineNode(String pipeLineNo) throws IOException {
		String sql = "select t.id,t.beginnodeL,t.endnodeL,t.beginnodeB,t.endnodeB "
				+ "from ptem_pipesection t where t.pipelineno='"
				+ pipeLineNo
				+ "' order by beginnodel ";
		List list = dbService.queryDataBySql(sql);
		//
		Object[] objs1;
		double latitudeE = 0;
		double longitudeE = 0;
		int size = 0;
		List nodeList = new ArrayList();
		//
		objs1 = (Object[]) list.get(0);
		latitudeE = Double.parseDouble(objs1[2].toString()); // 终点经度
		longitudeE = Double.parseDouble(objs1[4].toString()); // 终点纬度
		list.remove(0);
		//
		getNode(list, latitudeE, longitudeE, nodeList);
		size = list.size();
		while (size > 0) {
			objs1 = (Object[]) list.get(0);
			latitudeE = Double.parseDouble(objs1[2].toString()); // 终点经度
			longitudeE = Double.parseDouble(objs1[4].toString()); // 终点纬度
			list.remove(0);
			//
			getNode(list, latitudeE, longitudeE, nodeList);
			size = list.size();
		}
		int nodeListSize = nodeList.size();
		for (int k = 0; k < nodeListSize; k++) {
			Object[] objsTemp = (Object[]) nodeList.get(k);
			double lTemp = Double.parseDouble(objsTemp[0].toString());
			System.out.println(lTemp);
		}
		System.out.println("ok");
	}

	// 更新资料审查表3继承自表B管线中的字段
	public void updateMaterialReviewFromB() throws IOException {
		// 管线长度
		String sql = "update ptem_materials_review t1 set t1.pipelinelength= ";
		sql += "(select t2.length from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno)";
		sql += " where t1.pipelinelength is null";
		dbService.exeSql(sql);
		// 工程名称
		sql = "update ptem_materials_review t1 set t1.projectname= ";
		sql += "(select t2.projectname from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno)";
		sql += " where t1.projectname is null";
		dbService.exeSql(sql);
		// 管道规格
		sql = "update ptem_materials_review t1 set t1.PIPESTANDARD= ";
		sql += "(select t2.diameter from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno)";
		sql += " where t1.PIPESTANDARD is null";
		dbService.exeSql(sql);
		// 管道级别
		sql = "update ptem_materials_review t1 set t1.PIPELEVEL= ";
		sql += "(select t2.PRESSURELEVEL from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno)";
		sql += " where t1.PIPELEVEL is null";
		dbService.exeSql(sql);
		// 管道材质
		sql = "update ptem_materials_review t1 set t1.PIPEMATERIAL= ";
		sql += "(select t2.MATERIAL from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno)";
		sql += " where t1.PIPEMATERIAL is null";
		dbService.exeSql(sql);
		// 防腐方式（防腐层类型）
		sql = "update ptem_materials_review t1 set t1.CORROSIONPROTECTIOMODE= ";
		sql += "(select t2.COATINGTYPE from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno)";
		sql += " where t1.CORROSIONPROTECTIOMODE is null";
		dbService.exeSql(sql);
		// 阴极保护方式（阴极保护类型）
		sql = "update ptem_materials_review t1 set t1.CPTYPE= ";
		sql += "(select t2.CPTYPE from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno)";
		sql += " where t1.CPTYPE is null";
		dbService.exeSql(sql);
	}
	// 更新资料审查表3继承自表B管线中的字段部分
	public void updateMaterialReviewFromB(String ids) throws IOException {
		// 管线长度
		String sql = "update ptem_materials_review t1 set t1.pipelinelength= ";
		sql += "(select t2.length from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno)";
		sql += " where t1.pipelinelength is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
		// 工程名称
		sql = "update ptem_materials_review t1 set t1.projectname= ";
		sql += "(select t2.projectname from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno)";
		sql += " where t1.projectname is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
		// 管道规格
		sql = "update ptem_materials_review t1 set t1.PIPESTANDARD= ";
		sql += "(select t2.diameter from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno)";
		sql += " where t1.PIPESTANDARD is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
		// 管道级别
		sql = "update ptem_materials_review t1 set t1.PIPELEVEL= ";
		sql += "(select t2.PRESSURELEVEL from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno)";
		sql += " where t1.PIPELEVEL is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
		// 管道材质
		sql = "update ptem_materials_review t1 set t1.PIPEMATERIAL= ";
		sql += "(select t2.MATERIAL from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno)";
		sql += " where t1.PIPEMATERIAL is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
		// 防腐方式（防腐层类型）
		sql = "update ptem_materials_review t1 set t1.CORROSIONPROTECTIOMODE= ";
		sql += "(select t2.COATINGTYPE from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno)";
		sql += " where t1.CORROSIONPROTECTIOMODE is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
		// 阴极保护方式（阴极保护类型）
		sql = "update ptem_materials_review t1 set t1.CPTYPE= ";
		sql += "(select t2.CPTYPE from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno)";
		sql += " where t1.CPTYPE is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
	}

	// 更新资料审查表3继承自表A管线中的字段
	public void updateMaterialReviewFromA() throws IOException {
		// 设计单位
		String sql = "update ptem_materials_review t1 set t1.DESIGNUNIT= ";
		sql += "(select t3.DESIGNUNIT from ptem_project_info t3 where t3.projectno=";
		sql += "(select t2.projectno from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno))";
		sql += " where t1.DESIGNUNIT is null";
		dbService.exeSql(sql);
		// 设计规范
		sql = "update ptem_materials_review t1 set t1.DESIGNSTANDARD= ";
		sql += "(select t3.DESIGNSTANDARD from ptem_project_info t3 where t3.projectno=";
		sql += "(select t2.projectno from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno))";
		sql += " where t1.DESIGNSTANDARD is null";
		dbService.exeSql(sql);
		// 施工单位
		sql = "update ptem_materials_review t1 set t1.BUILDER= ";
		sql += "(select t3.BUILDER from ptem_project_info t3 where t3.projectno=";
		sql += "(select t2.projectno from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno))";
		sql += " where t1.BUILDER is null";
		dbService.exeSql(sql);
		// 施工规范
		sql = "update ptem_materials_review t1 set t1.BUILDSTANDARD= ";
		sql += "(select t3.BUILDSTANDARD from ptem_project_info t3 where t3.projectno=";
		sql += "(select t2.projectno from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno))";
		sql += " where t1.BUILDSTANDARD is null";
		dbService.exeSql(sql);
		// 防腐单位
		sql = "update ptem_materials_review t1 set t1.CORROSIONPROTECTIONUNIT= ";
		sql += "(select t3.CORROSIONPROTECTIONUNIT from ptem_project_info t3 where t3.projectno=";
		sql += "(select t2.projectno from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno))";
		sql += " where t1.CORROSIONPROTECTIONUNIT is null";
		dbService.exeSql(sql);
		// 防腐规范
		sql = "update ptem_materials_review t1 set t1.CORROSIONPROTECTIONSTANNDARD= ";
		sql += "(select t3.CORROSIONPROTECTIONSTANNDARD from ptem_project_info t3 where t3.projectno=";
		sql += "(select t2.projectno from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno))";
		sql += " where t1.CORROSIONPROTECTIONSTANNDARD is null";
		dbService.exeSql(sql);
		// 竣工日期
		sql = "update ptem_materials_review t1 set t1.COMPLETIONDATE= ";
		sql += "(select t3.COMPLETIONDATE from ptem_project_info t3 where t3.projectno=";
		sql += "(select t2.projectno from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno))";
		sql += " where t1.COMPLETIONDATE is null";
		dbService.exeSql(sql);
		// 铺设方式
		sql = "update ptem_materials_review t1 set t1.PAVEMODE= ";
		sql += "(select t3.PAVEMODE from ptem_project_info t3 where t3.projectno=";
		sql += "(select t2.projectno from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno))";
		sql += " where t1.PAVEMODE is null";
		dbService.exeSql(sql);
		// 通气日期
		sql = "update ptem_materials_review t1 set t1.AERATEDATE= ";
		sql += "(select t3.AERATEDATE from ptem_project_info t3 where t3.projectno=";
		sql += "(select t2.projectno from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno))";
		sql += " where t1.AERATEDATE is null";
		dbService.exeSql(sql);
	}
	// 更新资料审查表3继承自表A管线中的字段部分
	public void updateMaterialReviewFromA(String ids) throws IOException {
		// 设计单位
		String sql = "update ptem_materials_review t1 set t1.DESIGNUNIT= ";
		sql += "(select t3.DESIGNUNIT from ptem_project_info t3 where t3.projectno=";
		sql += "(select t2.projectno from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno))";
		sql += " where t1.DESIGNUNIT is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
		// 设计规范
		sql = "update ptem_materials_review t1 set t1.DESIGNSTANDARD= ";
		sql += "(select t3.DESIGNSTANDARD from ptem_project_info t3 where t3.projectno=";
		sql += "(select t2.projectno from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno))";
		sql += " where t1.DESIGNSTANDARD is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
		// 施工单位
		sql = "update ptem_materials_review t1 set t1.BUILDER= ";
		sql += "(select t3.BUILDER from ptem_project_info t3 where t3.projectno=";
		sql += "(select t2.projectno from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno))";
		sql += " where t1.BUILDER is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
		// 施工规范
		sql = "update ptem_materials_review t1 set t1.BUILDSTANDARD= ";
		sql += "(select t3.BUILDSTANDARD from ptem_project_info t3 where t3.projectno=";
		sql += "(select t2.projectno from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno))";
		sql += " where t1.BUILDSTANDARD is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
		// 防腐单位
		sql = "update ptem_materials_review t1 set t1.CORROSIONPROTECTIONUNIT= ";
		sql += "(select t3.CORROSIONPROTECTIONUNIT from ptem_project_info t3 where t3.projectno=";
		sql += "(select t2.projectno from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno))";
		sql += " where t1.CORROSIONPROTECTIONUNIT is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
		// 防腐规范
		sql = "update ptem_materials_review t1 set t1.CORROSIONPROTECTIONSTANNDARD= ";
		sql += "(select t3.CORROSIONPROTECTIONSTANNDARD from ptem_project_info t3 where t3.projectno=";
		sql += "(select t2.projectno from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno))";
		sql += " where t1.CORROSIONPROTECTIONSTANNDARD is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
		// 竣工日期
		sql = "update ptem_materials_review t1 set t1.COMPLETIONDATE= ";
		sql += "(select t3.COMPLETIONDATE from ptem_project_info t3 where t3.projectno=";
		sql += "(select t2.projectno from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno))";
		sql += " where t1.COMPLETIONDATE is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
		// 铺设方式
		sql = "update ptem_materials_review t1 set t1.PAVEMODE= ";
		sql += "(select t3.PAVEMODE from ptem_project_info t3 where t3.projectno=";
		sql += "(select t2.projectno from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno))";
		sql += " where t1.PAVEMODE is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
		// 通气日期
		sql = "update ptem_materials_review t1 set t1.AERATEDATE= ";
		sql += "(select t3.AERATEDATE from ptem_project_info t3 where t3.projectno=";
		sql += "(select t2.projectno from ptem_pipeline t2 where t2.pipelineno=t1.pipelineno))";
		sql += " where t1.AERATEDATE is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
	}
	// 更新资料审查表3
	public void updateMaterialReview() throws IOException {
		// 继承自表B
		updateMaterialReviewFromB();
		// 继承自表A
		updateMaterialReviewFromA();
	}
	// 更新资料审查表3部分
	public void updateMaterialReview(String ids) throws IOException {
		// 继承自表B
		updateMaterialReviewFromB(ids);
		// 继承自表A
		updateMaterialReviewFromA(ids);
	}
	// 更新继承自管线表的管段表中的字段
	public void updatePipeSectionFromPipeline() throws IOException {
		String sql = "select t.id,t.PIPELINENO from ptem_pipesection t";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object objs[] = list.get(i);
			String id = objs[0].toString();
			String pipelineno = "";
			if (objs[1] == null) {
				continue;
			}
			pipelineno = objs[1].toString();
			// 压力级制、通气时间、铺设方式、材质、材质牌号、
			// 通径、外径、壁厚、管理单位、管理部门
			sql = "select t.PRESSURELEVEL,t.AERATEDATE,t.PAVEMODE,t.MATERIAL,t.MATERIALMARK,"
					+ "t.DIAMETER,t.OUTERDIAMETER,t.THICKNESS,t.MANAGEUNIT,t.MANAGEDEPARTMENT";
			sql += " from ptem_pipeline t where t.pipelineno='";
			sql += pipelineno;
			sql += "'";
			sql += "and( t.PRESSURELEVEL is not null or t.AERATEDATE is not null or "
					+ "t.PAVEMODE is not null or t.MATERIAL is not null or "
					+ "t.MATERIALMARK is not null or t.DIAMETER is not null or "
					+ "t.OUTERDIAMETER is not null or t.THICKNESS is not null or "
					+ "t.MANAGEUNIT is not null or t.MANAGEDEPARTMENT is not null)";
			List<Object[]> pipelinelist = dbService.queryDataBySql(sql);
			if (pipelinelist.size() == 0) {
				continue;
			}
			Object objvalues[] = pipelinelist.get(0);
			String pressurelevel = "";
			String areatedate = "";
			String pavemode = "";
			String material = "";
			String materialmark = "";
			String diameter = "";
			String outerdiameter = "";
			String thickness = "";
			String manageunit = "";
			String managedepartment = "";
			if (objvalues[0] != null) {
				pressurelevel = objvalues[0].toString();
			}
			if (objvalues[1] != null) {
				areatedate = objvalues[1].toString();
			}
			if (objvalues[2] != null) {
				pavemode = objvalues[2].toString();
			}
			if (objvalues[3] != null) {
				material = objvalues[3].toString();
			}
			if (objvalues[4] != null) {
				materialmark = objvalues[4].toString();
			}
			if (objvalues[5] != null) {
				diameter = objvalues[5].toString();
				String diameters[] = diameter.split("；");
				diameter = diameters[0];
			}
			if (objvalues[6] != null) {
				outerdiameter = objvalues[6].toString();
				String outerdiameters[] = outerdiameter.split("；");
				outerdiameter = outerdiameters[0];
			}
			if (objvalues[7] != null) {
				thickness = objvalues[7].toString();
				String thicknesss[] = thickness.split("；");
				thickness = thicknesss[0];
			}
			if (objvalues[8] != null) {
				manageunit = objvalues[8].toString();
			}
			if (objvalues[9] != null) {
				managedepartment = objvalues[9].toString();
			}
			// 压力级制
			sql = "update ptem_pipesection t set t.PRESSURELEVEL='";
			sql += pressurelevel;
			sql += "' where t.PRESSURELEVEL is null";
			sql += " and t.id='" + id + "'";
			// sql+=" where t.id='"+id+"'";
			dbService.exeSql(sql);
			// 通气时间
			//查询表A中的通气时间
			sql = "select t2.AERATEDATE from PTEM_PROJECT_INFO t2,PTEM_PIPELINE t1 "
					+ "where t2.PROJECTNO=t1.PROJECTNO and t1.pipelineno='";
			sql+=pipelineno;
			sql+="'";
			List<Object> aeratedatelist=dbService.queryDataBySql(sql);
			if(aeratedatelist.size()!=0&&aeratedatelist.get(0)!=null)
			{
				areatedate=aeratedatelist.get(0).toString();
				//更新通气时间
				sql = "update ptem_pipesection t set t.AERATEDATE=to_date('";
				sql += areatedate;
				sql += "','YYYY-MM-DD') where t.AERATEDATE is null";
				sql += " and t.id='" + id + "'";
				// sql+="','YYYY-MM-DD') where t.id='"+id+"'";
				dbService.exeSql(sql);
			}			
			// 铺设方式
			sql = "update ptem_pipesection t set t.PAVEMODE='";
			sql += pavemode;
			// sql+="' where t.id='"+id+"'";
			sql += "' where t.PAVEMODE is null";
			sql += " and t.id='" + id + "'";
			dbService.exeSql(sql);
			// 材质
			sql = "update ptem_pipesection t set t.MATERIAL='";
			sql += material;
			// sql+="' where t.id='"+id+"'";
			sql += "' where t.MATERIAL is null";
			sql += " and t.id='" + id + "'";
			dbService.exeSql(sql);
			// 材质牌号
			sql = "update ptem_pipesection t set t.MATERIALMARK='";
			sql += materialmark;
			// sql+="' where t.id='"+id+"'";
			sql += "' where t.MATERIALMARK is null";
			sql += " and t.id='" + id + "'";
			dbService.exeSql(sql);
			// 通径
			sql = "update ptem_pipesection t set t.DIAMETER='";
			sql += diameter;
			// sql+="' where t.id='"+id+"'";
			sql += "' where t.DIAMETER is null";
			sql += " and t.id='" + id + "'";
			dbService.exeSql(sql);
			// 外径
			sql = "update ptem_pipesection t set t.OUTERDIAMETER='";
			sql += outerdiameter;
			// sql+="' where t.id='"+id+"'";
			sql += "' where t.OUTERDIAMETER is null";
			sql += " and t.id='" + id + "'";
			dbService.exeSql(sql);
			// 壁厚
			sql = "update ptem_pipesection t set t.THICKNESS='";
			sql += thickness;
			// sql+="' where t.id='"+id+"'";
			sql += "' where t.THICKNESS is null";
			sql += " and t.id='" + id + "'";
			dbService.exeSql(sql);
			// 管理单位
			sql = "update ptem_pipesection t set t.MANAGEUNIT='";
			sql += manageunit;
			// sql+="' where t.id='"+id+"'";
			sql += "' where t.MANAGEUNIT is null";
			sql += " and t.id='" + id + "'";
			dbService.exeSql(sql);
			// 管理部门
			sql = "update ptem_pipesection t set t.MANAGEDEPARTMENT='";
			sql += managedepartment;
			// sql+="' where t.id='"+id+"'";
			sql += "' where t.MANAGEDEPARTMENT is null";
			sql += " and t.id='" + id + "'";
			dbService.exeSql(sql);
			/*
			 * sql="update ptem_pipesection t set t.PRESSURELEVEL='";
			 * sql+=pressurelevel; sql+="',t.AERATEDATE=to_date('";
			 * sql+=areatedate; sql+="','YYYY-MM-DD')"; sql+=",t.PAVEMODE='";
			 * sql+=pavemode; sql+="',t.MATERIAL='"; sql+=material;
			 * sql+="',t.MATERIALMARK='"; sql+=materialmark;
			 * sql+="',t.DIAMETER='"; sql+=diameter; sql+="',t.OUTERDIAMETER='";
			 * sql+=outerdiameter; sql+="',t.THICKNESS='"; sql+=thickness;
			 * sql+="',t.MANAGEUNIT='"; sql+=manageunit;
			 * sql+="',t.MANAGEDEPARTMENT='"; sql+=managedepartment; sql+="'
			 * where t.id='"; sql+=id; sql+="'"; dbService.exeSql(sql);
			 */

		}
	}
	public void updatePipeSectionFromPipeline(String ids) throws IOException {
		String sql = "select t.id,t.PIPELINENO from ptem_pipesection t";
		sql+=" where t.id in("+ids+")";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object objs[] = list.get(i);
			String id = objs[0].toString();
			String pipelineno = "";
			if (objs[1] == null) {
				continue;
			}
			pipelineno = objs[1].toString();
			// 压力级制、通气时间、铺设方式、材质、材质牌号、
			// 通径、外径、壁厚、管理单位、管理部门
			sql = "select t.PRESSURELEVEL,t.AERATEDATE,t.PAVEMODE,t.MATERIAL,t.MATERIALMARK,"
					+ "t.DIAMETER,t.OUTERDIAMETER,t.THICKNESS,t.MANAGEUNIT,t.MANAGEDEPARTMENT";
			sql += " from ptem_pipeline t where t.pipelineno='";
			sql += pipelineno;
			sql += "'";
			sql += "and( t.PRESSURELEVEL is not null or t.AERATEDATE is not null or "
					+ "t.PAVEMODE is not null or t.MATERIAL is not null or "
					+ "t.MATERIALMARK is not null or t.DIAMETER is not null or "
					+ "t.OUTERDIAMETER is not null or t.THICKNESS is not null or "
					+ "t.MANAGEUNIT is not null or t.MANAGEDEPARTMENT is not null)";
			List<Object[]> pipelinelist = dbService.queryDataBySql(sql);
			if (pipelinelist.size() == 0) {
				continue;
			}
			Object objvalues[] = pipelinelist.get(0);
			String pressurelevel = "";
			String areatedate = "";
			String pavemode = "";
			String material = "";
			String materialmark = "";
			String diameter = "";
			String outerdiameter = "";
			String thickness = "";
			String manageunit = "";
			String managedepartment = "";
			if (objvalues[0] != null) {
				pressurelevel = objvalues[0].toString();
			}
			if (objvalues[1] != null) {
				areatedate = objvalues[1].toString();
			}
			if (objvalues[2] != null) {
				pavemode = objvalues[2].toString();
			}
			if (objvalues[3] != null) {
				material = objvalues[3].toString();
			}
			if (objvalues[4] != null) {
				materialmark = objvalues[4].toString();
			}
			if (objvalues[5] != null) {
				diameter = objvalues[5].toString();
				String diameters[] = diameter.split("；");
				diameter = diameters[0];
			}
			if (objvalues[6] != null) {
				outerdiameter = objvalues[6].toString();
				String outerdiameters[] = outerdiameter.split("；");
				outerdiameter = outerdiameters[0];
			}
			if (objvalues[7] != null) {
				thickness = objvalues[7].toString();
				String thicknesss[] = thickness.split("；");
				thickness = thicknesss[0];
			}
			if (objvalues[8] != null) {
				manageunit = objvalues[8].toString();
			}
			if (objvalues[9] != null) {
				managedepartment = objvalues[9].toString();
			}
			// 压力级制
			sql = "update ptem_pipesection t set t.PRESSURELEVEL='";
			sql += pressurelevel;
			sql += "' where t.PRESSURELEVEL is null";
			sql += " and t.id='" + id + "'";
			// sql+=" where t.id='"+id+"'";
			dbService.exeSql(sql);
			// 通气时间
			//查询表A中的通气时间
			sql = "select t2.AERATEDATE from PTEM_PROJECT_INFO t2,PTEM_PIPELINE t1 "
					+ "where t2.PROJECTNO=t1.PROJECTNO and t1.pipelineno='";
			sql+=pipelineno;
			sql+="'";
			List<Object> aeratedatelist=dbService.queryDataBySql(sql);
			if(aeratedatelist.size()!=0&&aeratedatelist.get(0)!=null)
			{
				areatedate=aeratedatelist.get(0).toString();
				//更新通气时间
				sql = "update ptem_pipesection t set t.AERATEDATE=to_date('";
				sql += areatedate;
				sql += "','YYYY-MM-DD') where t.AERATEDATE is null";
				sql += " and t.id='" + id + "'";
				// sql+="','YYYY-MM-DD') where t.id='"+id+"'";
				dbService.exeSql(sql);
			}			
			// 铺设方式
			sql = "update ptem_pipesection t set t.PAVEMODE='";
			sql += pavemode;
			// sql+="' where t.id='"+id+"'";
			sql += "' where t.PAVEMODE is null";
			sql += " and t.id='" + id + "'";
			dbService.exeSql(sql);
			// 材质
			sql = "update ptem_pipesection t set t.MATERIAL='";
			sql += material;
			// sql+="' where t.id='"+id+"'";
			sql += "' where t.MATERIAL is null";
			sql += " and t.id='" + id + "'";
			dbService.exeSql(sql);
			// 材质牌号
			sql = "update ptem_pipesection t set t.MATERIALMARK='";
			sql += materialmark;
			// sql+="' where t.id='"+id+"'";
			sql += "' where t.MATERIALMARK is null";
			sql += " and t.id='" + id + "'";
			dbService.exeSql(sql);
			// 通径
			sql = "update ptem_pipesection t set t.DIAMETER='";
			sql += diameter;
			// sql+="' where t.id='"+id+"'";
			sql += "' where t.DIAMETER is null";
			sql += " and t.id='" + id + "'";
			dbService.exeSql(sql);
			// 外径
			sql = "update ptem_pipesection t set t.OUTERDIAMETER='";
			sql += outerdiameter;
			// sql+="' where t.id='"+id+"'";
			sql += "' where t.OUTERDIAMETER is null";
			sql += " and t.id='" + id + "'";
			dbService.exeSql(sql);
			// 壁厚
			sql = "update ptem_pipesection t set t.THICKNESS='";
			sql += thickness;
			// sql+="' where t.id='"+id+"'";
			sql += "' where t.THICKNESS is null";
			sql += " and t.id='" + id + "'";
			dbService.exeSql(sql);
			// 管理单位
			sql = "update ptem_pipesection t set t.MANAGEUNIT='";
			sql += manageunit;
			// sql+="' where t.id='"+id+"'";
			sql += "' where t.MANAGEUNIT is null";
			sql += " and t.id='" + id + "'";
			dbService.exeSql(sql);
			// 管理部门
			sql = "update ptem_pipesection t set t.MANAGEDEPARTMENT='";
			sql += managedepartment;
			// sql+="' where t.id='"+id+"'";
			sql += "' where t.MANAGEDEPARTMENT is null";
			sql += " and t.id='" + id + "'";
			dbService.exeSql(sql);
			/*
			 * sql="update ptem_pipesection t set t.PRESSURELEVEL='";
			 * sql+=pressurelevel; sql+="',t.AERATEDATE=to_date('";
			 * sql+=areatedate; sql+="','YYYY-MM-DD')"; sql+=",t.PAVEMODE='";
			 * sql+=pavemode; sql+="',t.MATERIAL='"; sql+=material;
			 * sql+="',t.MATERIALMARK='"; sql+=materialmark;
			 * sql+="',t.DIAMETER='"; sql+=diameter; sql+="',t.OUTERDIAMETER='";
			 * sql+=outerdiameter; sql+="',t.THICKNESS='"; sql+=thickness;
			 * sql+="',t.MANAGEUNIT='"; sql+=manageunit;
			 * sql+="',t.MANAGEDEPARTMENT='"; sql+=managedepartment; sql+="'
			 * where t.id='"; sql+=id; sql+="'"; dbService.exeSql(sql);
			 */

		}
	}

	//
	public String getJudgerepeatSingle(String planelength, String reallength,
			String beginnodex, String beginnodey, String beginnodeh,
			String endnodex, String endnodey, String endnodeh)
			throws IOException {
		String res = "";
		if (planelength.equals("0") && !reallength.equals("0")) {
			res = "立管";
		} else if (planelength.equals("0") && beginnodex.equals(endnodex)
				&& beginnodey.equals(endnodey) && beginnodeh.equals(endnodeh)) {
			res = "重复";
		}
		return res;
	}

	// 更新管段表中的判断立管和重复
	public void updateJudgerepeat() throws IOException {
		String planelength = "";
		String reallength = "";
		String beginnodex = "";
		String beginnodey = "";
		String beginnodeh = "";
		String endnodex = "";
		String endnodey = "";
		String endnodeh = "";
		String id = "";
		String sql = "select t.id,t.PLANELENGTH,t.REALLENGTH,t.BEGINNODEX,"
				+ "t.BEGINNODEY,t.BEGINNODEH,t.ENDNODEX,t.ENDNODEY,"
				+ "t.ENDNODEH from PTEM_PIPESECTION t ";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			if (obj[0] != null) {
				id = obj[0].toString();
			}
			if (obj[1] != null) {
				planelength = obj[1].toString();
			}
			if (obj[2] != null) {
				reallength = obj[2].toString();
			}
			if (obj[3] != null) {
				beginnodex = obj[3].toString();
			}
			if (obj[4] != null) {
				beginnodey = obj[4].toString();
			}
			if (obj[5] != null) {
				beginnodeh = obj[5].toString();
			}
			if (obj[6] != null) {
				endnodex = obj[6].toString();
			}
			if (obj[7] != null) {
				endnodey = obj[7].toString();
			}
			if (obj[8] != null) {
				endnodeh = obj[8].toString();
			}
			String judge = getJudgerepeatSingle(planelength, reallength,
					beginnodex, beginnodey, beginnodeh, endnodex, endnodey,
					endnodeh);
			sql = "update ptem_pipesection t set t.JUDGEREPEAT='";
			sql += judge;
			sql += "'where t.id='";
			sql += id;
			sql += "'";
			sql += " and t.JUDGEREPEAT is null";
			dbService.exeSql(sql);
		}
	}
	public void updateJudgerepeat(String ids) throws IOException {
		String planelength = "";
		String reallength = "";
		String beginnodex = "";
		String beginnodey = "";
		String beginnodeh = "";
		String endnodex = "";
		String endnodey = "";
		String endnodeh = "";
		String id = "";
		String sql = "select t.id,t.PLANELENGTH,t.REALLENGTH,t.BEGINNODEX,"
				+ "t.BEGINNODEY,t.BEGINNODEH,t.ENDNODEX,t.ENDNODEY,"
				+ "t.ENDNODEH from PTEM_PIPESECTION t ";
		sql+="where t.id in("+ids+")";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			if (obj[0] != null) {
				id = obj[0].toString();
			}
			if (obj[1] != null) {
				planelength = obj[1].toString();
			}
			if (obj[2] != null) {
				reallength = obj[2].toString();
			}
			if (obj[3] != null) {
				beginnodex = obj[3].toString();
			}
			if (obj[4] != null) {
				beginnodey = obj[4].toString();
			}
			if (obj[5] != null) {
				beginnodeh = obj[5].toString();
			}
			if (obj[6] != null) {
				endnodex = obj[6].toString();
			}
			if (obj[7] != null) {
				endnodey = obj[7].toString();
			}
			if (obj[8] != null) {
				endnodeh = obj[8].toString();
			}
			String judge = getJudgerepeatSingle(planelength, reallength,
					beginnodex, beginnodey, beginnodeh, endnodex, endnodey,
					endnodeh);
			sql = "update ptem_pipesection t set t.JUDGEREPEAT='";
			sql += judge;
			sql += "'where t.id='";
			sql += id;
			sql += "'";
			sql += " and t.JUDGEREPEAT is null";
			dbService.exeSql(sql);
		}
	}

	// 更新管段表中的平面长度、实际长度
	public void updatePipeSectionLength() throws IOException {
		// 更新管段表长度
		String sql = "select t.id,t.beginnodey,t.endnodey,t.beginnodex,t.endnodex,"
				+ "t.beginnodeh,t.endnodeh from ptem_pipesection t  " +
				// "where planelength='0' or reallength='0' ";
				"where t.planelength is null or t.reallength is null ";
		List list = dbService.queryDataBySql(sql);
		for (int i = 0; i < list.size(); i++) {
			Object[] objs = (Object[]) list.get(i);
			String strID = (String) objs[0];
			double y1 = Double.parseDouble(objs[1].toString());
			double y2 = Double.parseDouble(objs[2].toString());
			double x1 = Double.parseDouble(objs[3].toString());
			double x2 = Double.parseDouble(objs[4].toString());
			double h1 = Double.parseDouble(objs[5].toString());
			double h2 = Double.parseDouble(objs[6].toString());
			double planeLength = getPlaneLength(y1, y2, x1, x2);
			double realLength = getRealLength(y1, y2, x1, x2, h1, h2);
			String strPlaneLength = Double.toString(planeLength);
			String strRealLength = Double.toString(realLength);
			sql = "update ptem_pipesection t set t.planelength='"
					+ strPlaneLength + "'";
			sql += " where t.planelength is null";
			sql += " and t.id='" + strID + "'";
			// sql+=" where t.id='"+strID+"'";

			dbService.exeSql(sql);
			sql = "update ptem_pipesection t set t.reallength='"
					+ strRealLength + "'";
			sql += " where t.reallength is null";
			sql += " and t.id='" + strID + "'";
			// sql+=" where t.id='"+strID+"'";
			dbService.exeSql(sql);
		}
	}
	public void updatePipeSectionLength(String ids) throws IOException {
		// 更新管段表长度
		String sql = "select t.id,t.beginnodey,t.endnodey,t.beginnodex,t.endnodex,"
				+ "t.beginnodeh,t.endnodeh from ptem_pipesection t  " +
				// "where planelength='0' or reallength='0' ";
				"where (t.planelength is null or t.reallength is null) ";
		sql+="and t.id in("+ids+")";
		List list = dbService.queryDataBySql(sql);
		for (int i = 0; i < list.size(); i++) {
			Object[] objs = (Object[]) list.get(i);
			String strID = (String) objs[0];
			double y1 = Double.parseDouble(objs[1].toString());
			double y2 = Double.parseDouble(objs[2].toString());
			double x1 = Double.parseDouble(objs[3].toString());
			double x2 = Double.parseDouble(objs[4].toString());
			double h1 = Double.parseDouble(objs[5].toString());
			double h2 = Double.parseDouble(objs[6].toString());
			double planeLength = getPlaneLength(y1, y2, x1, x2);
			double realLength = getRealLength(y1, y2, x1, x2, h1, h2);
			String strPlaneLength = Double.toString(planeLength);
			String strRealLength = Double.toString(realLength);
			sql = "update ptem_pipesection t set t.planelength='"
					+ strPlaneLength + "'";
			sql += " where t.planelength is null";
			sql += " and t.id='" + strID + "'";
			// sql+=" where t.id='"+strID+"'";

			dbService.exeSql(sql);
			sql = "update ptem_pipesection t set t.reallength='"
					+ strRealLength + "'";
			sql += " where t.reallength is null";
			sql += " and t.id='" + strID + "'";
			// sql+=" where t.id='"+strID+"'";
			dbService.exeSql(sql);
		}
	}

	public int updatePipeLineCoord() {
		String sql = "select pipelineno from ptem_pipeline";
		List<String> list = dbService.queryDataBySql(sql);
		int size = list.size();
		int res=0;
		for (int i = 0; i < size; i++) {
			String pipeLineNo = list.get(i);
			// String pipeLineNo="010811818";
			// 管段排序获取管线节点
			res=SortPipeSection(pipeLineNo);
			if(res!=0)
			{
				return res;
			}
		}
		return res;
	}
	
	public int updatePipeLineCoordNode() {
		String sql = "select pipelineno from ptem_pipeline";
		List<String> list = dbService.queryDataBySql(sql);
		int size = list.size();
		int res=0;
		for (int i = 0; i < size; i++) {
			String pipeLineNo = list.get(i);
			// String pipeLineNo="010811818";
			// 管段排序获取管线节点
			res=SortPipeSection(pipeLineNo);
			if(res!=0)
			{
				continue;
				//return res;
			}
		}
		return res;
	}
	public void updatePipeLineCoord(String ids) {
		String sql = "select pipelineno from ptem_pipeline";
		sql+=" where id in("+ids+")";
		List<String> list = dbService.queryDataBySql(sql);
		int size = list.size();
		for (int i = 0; i < size; i++) {
			String pipeLineNo = list.get(i);
			// String pipeLineNo="010811818";
			// 管段排序获取管线节点
			SortPipeSection(pipeLineNo);
		}
	}
	// 根据管网编号更新管线编号
	public void updatePipeLineNo(String tablename) {
		String sql = "select t.id,t.PIPENO from ";
		sql += tablename;
		sql += " t where t.pipeno is not null";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			String pipeno = obj[1].toString();
			String pipelineno = pipeno.substring(0, 9);
			String sqlUpdate = "update ";
			sqlUpdate += tablename;
			sqlUpdate += " t set t.pipelineno='";
			sqlUpdate += pipelineno;
			sqlUpdate += "'";
			sqlUpdate += "where t.id='";
			sqlUpdate += id;
			sqlUpdate += "'";
			sqlUpdate += " and t.pipelineno is null";
			dbService.exeSql(sqlUpdate);
		}
	}

	// 根据管网编号更新管线编号
	public void updatePipeLineNo(String tablename, String fieldname) {
		String sql = "select t.id,t.";
		sql += fieldname;
		sql += " from ";
		sql += tablename;
		sql += " t where t.";
		sql += fieldname;
		sql += " is not null";
		sql+=" and t.pipelineno is null";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			String pipeno = obj[1].toString();
			// 判断是否包含多个管网编号
			String pipenos[] = pipeno.split("；");
			pipeno = pipenos[0];
			// 获取管线编号
			if(pipeno.length()<14)
			{
				System.out.println(pipeno);
			}
			String pipelineno = pipeno.substring(0, 9);
			String sqlUpdate = "update ";
			sqlUpdate += tablename;
			sqlUpdate += " t set t.pipelineno='";
			sqlUpdate += pipelineno;
			sqlUpdate += "'";
			sqlUpdate += "where t.id='";
			sqlUpdate += id;
			sqlUpdate += "'";
			sqlUpdate += " and t.pipelineno is null";
			dbService.exeSql(sqlUpdate);
		}
	}
	public void updatePipeLineNo(String tablename, String fieldname,String ids) {
		String sql = "select t.id,t.";
		sql += fieldname;
		sql += " from ";
		sql += tablename;
		sql += " t where t.";
		sql += fieldname;
		sql += " is not null";
		sql+=" and t.id in("+ids+")";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			String pipeno = obj[1].toString();
			// 判断是否包含多个管网编号
			String pipenos[] = pipeno.split("；");
			pipeno = pipenos[0];
			// 获取管线编号
			String pipelineno = pipeno.substring(0, 9);
			String sqlUpdate = "update ";
			sqlUpdate += tablename;
			sqlUpdate += " t set t.pipelineno='";
			sqlUpdate += pipelineno;
			sqlUpdate += "'";
			sqlUpdate += " where t.id='";
			sqlUpdate += id;
			sqlUpdate += "'";
			sqlUpdate += " and t.pipelineno is null";
			dbService.exeSql(sqlUpdate);
		}
	}

	public void updatePipeLineNo() {
		String tablename = "PTEM_EMERGENCY";// 表G 应急事件
		updatePipeLineNo(tablename);
		tablename = "PTEM_OPERATIONS"; // 生产作业
		updatePipeLineNo(tablename);
		tablename = "ptem_point_crossing"; // 穿跨越
		updatePipeLineNo(tablename);
	}

	public void updateDictionaryTable() {
		String sql = "select t.field,t.ownertable,t.dictionary from ptem_fielddic_map t";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String field = obj[0].toString();
			String ownertable = obj[1].toString();
			String dictionary = obj[2].toString();
			sql = "select distinct ";
			sql += field;
			sql += " from ";
			sql += ownertable;
			sql += " where ";
			sql += field;
			sql += " is not null";
			List<Object> fieldValues = dbService.queryDataBySql(sql);
			// 删除字典表中原来的数据
			sql = "delete from ";
			sql += dictionary;
			dbService.exeSql(sql);
			// 更新字典表
			int valueNum = fieldValues.size();
			for (int j = 0; j < valueNum; j++) {
				String fieldValue = null;
				if (dictionary.equals("PTEM_TYPE_DESIGNTEMPRATURE")) {
					fieldValue = fieldValues.get(j).toString();
				} else {
					fieldValue = fieldValues.get(j).toString();
				}

				if (fieldValue == null) {
					continue;
				}
				String id = Integer.toString(j + 1);
				String sqlT = "insert into ";
				sqlT += dictionary;
				sqlT += "(id,TYPENAME,TYPEINDEX)values('";
				sqlT += id;
				if (dictionary.equals("PTEM_TYPE_DESIGNTEMPRATURE")) {
					sqlT += "',";
					sqlT += fieldValue;
					sqlT += ",'";
					sqlT += id;
					sqlT += "')";
				} else {
					sqlT += "','";
					sqlT += fieldValue;
					sqlT += "','";
					sqlT += id;
					sqlT += "')";
				}

				dbService.exeSql(sqlT);
			}
		}
	}

	// 更新内衬编号
	public void updateLinerNo(String tablename, String noName, String title)
			throws IOException {
		String sql = "select t.id,t.pipelineno from ";
		sql += tablename;
		sql += " t";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();

			// String pipelineno=obj[1].toString();
			// 计算流水号
			String serialNo = "";
			serialNo = String.format("%04d", i + 1);
			// 获取当前日期
			Date date = new Date();
			DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
			String strdate = format.format(date);
			// 生成编号
			// String pointNoVal=title+pipelineno+serialNo;
			String pointNoVal = title + strdate + serialNo;
			// 更新表
			sql = "update ";
			sql += tablename;
			sql += " t set t.";
			sql += noName;
			sql += "='";
			sql += pointNoVal;
			sql += "' where t.id='";
			sql += id;
			sql += "'";
			sql += " and t.";
			sql += noName;
			sql += " is null";
			dbService.exeSql(sql);
		}
	}
	// 更新内衬编号部分
	public void updateLinerNo(String tablename, String noName, String title,String ids)
			throws IOException {
		String sql = "select t.id,t.pipelineno from ";
		sql += tablename;
		sql += " t";
		sql+=" where t.id in("+ids+")";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			// String pipelineno=obj[1].toString();
			// 计算流水号
			String serialNo = "";
			serialNo = String.format("%04d", i + 1);
			// 获取当前日期
			Date date = new Date();
			DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
			String strdate = format.format(date);
			// 生成编号
			// String pointNoVal=title+pipelineno+serialNo;
			String pointNoVal = title + strdate + serialNo;
			// 更新表
			sql = "update ";
			sql += tablename;
			sql += " t set t.";
			sql += noName;
			sql += "='";
			sql += pointNoVal;
			sql += "' where t.id='";
			sql += id;
			sql += "'";
			sql += " and t.";
			sql += noName;
			sql += " is null";
			dbService.exeSql(sql);
		}
	}
	// 更新特征点表的特征点编号
	public void updatePointNo(String tablename, String noName, String title)
			throws IOException {
		String sql = "select t.id,t.pipelineno from ";
		sql += tablename;
		sql += " t";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			String pipelineno = obj[1].toString();
			// 计算流水号
			String serialNo = "";
			serialNo = String.format("%04d", i + 1);
			String pointNoVal = title + pipelineno + serialNo;
			sql = "update ";
			sql += tablename;
			sql += " t set t.";
			sql += noName;
			sql += "='";
			sql += pointNoVal;
			sql += "' where t.id='";
			sql += id;
			sql += "'";
			// sql+=" and t.";
			// sql+=noName;
			// sql+=" is null";
			dbService.exeSql(sql);
		}
	}
	public void updatePointNo(String tablename, String noName, String title,String ids)
		throws IOException {
		String sql = "select t.id,t.pipelineno from ";
		sql += tablename;
		sql += " t";
		sql+=" where t.id in("+ids+")";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			String pipelineno = obj[1].toString();
			// 计算流水号
			String serialNo = "";
			serialNo = String.format("%04d", i + 1);
			String pointNoVal = title + pipelineno + serialNo;
			sql = "update ";
			sql += tablename;
			sql += " t set t.";
			sql += noName;
			sql += "='";
			sql += pointNoVal;
			sql += "' where t.id='";
			sql += id;
			sql += "'";
			// sql+=" and t.";
			// sql+=noName;
			// sql+=" is null";
			dbService.exeSql(sql);
		}
	}
	public void updatePointNoAll() throws IOException {
		// 特征点检测中的特征点编号
		updatePointNo("ptem_point_test", "pointno", "TSD");
		// 特征点表的特征点编号
		updatePointNo("ptem_pipepoint", "pointno", "TSD");
		// //三通编号
		// updatePointNo("ptem_point_tee","teeno","ST");
		// //阳极编号
		// updatePointNo("ptem_point_anode","anodeno","YJ");
		// //测试桩
		// //排流装置
		// //穿跨越
		// //套管
		// updatePointNo("ptem_point_casing","casingno","TG");
		// //弯管编号
		// updatePointNo("ptem_point_bend","bendno","WG");
		// //内衬
		// //土壤检测点编号
		// updatePointNo("ptem_soilcorrosion","testpointno","TRD");
		// //杂散检测点编号
		// updatePointNo("ptem_straycurrenttest","STRAYPOINTNO","ZSD");
		// //破损点编号
		// updatePointNo("ptem_coating_damagedpoint","DAMAGEPOINTNO","PSD");
	}

	// 转换经纬度
	public void convertLongitudeLatitude() throws IOException {
		String sql = "select t.id,t.longitude,t.latutide from ptem_cips_test_data t ";
		sql += "where t.islbconverted=0 or t.islbconverted is null ";
		List list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = (Object[]) list.get(i);
			String id = obj[0].toString();
			// if(id.equals("111"))
			// {
			// continue;
			// }
			String longitude = obj[1].toString();
			String latitude = obj[2].toString();
			// 转换经度
			String longiLeft = longitude.substring(0, 3);
			String longiRight = longitude.substring(3);
			Integer longiLeftI = Integer.parseInt(longiLeft);
			Double longiRightD = Double.parseDouble(longiRight);
			Double longitudeNewD = longiLeftI + longiRightD / 60;
			String longitudeNew = longitudeNewD.toString();
			// 转换纬度
			String latiLeft = latitude.substring(0, 2);
			String latiRight = latitude.substring(2);
			Integer latiLeftI = Integer.parseInt(latiLeft);
			Double latiRightD = Double.parseDouble(latiRight);
			Double latitudeNewD = latiLeftI + latiRightD / 60;
			String latitudeNew = latitudeNewD.toString();
			// 更新
			sql = "update ptem_cips_test_data t set t.longitude='";
			sql += longitudeNew;
			sql += "'";
			sql += " ,t.latutide='";
			sql += latitudeNew;
			sql += "'";
			sql += ",t.islbconverted=1";
			sql += " where t.id='";
			sql += id;
			sql += "'";
			dbService.exeSql(sql);
		}
	}
	// 转换经纬度部分
	public void convertLongitudeLatitude(String ids) throws IOException {
		String sql = "select t.id,t.longitude,t.latutide from ptem_cips_test_data t ";
		sql += "where (t.islbconverted=0 or t.islbconverted is null) ";
		sql+=" and t.id in("+ids+")";
		List list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = (Object[]) list.get(i);
			String id = obj[0].toString();
			// if(id.equals("111"))
			// {
			// continue;
			// }
			String longitude = obj[1].toString();
			String latitude = obj[2].toString();
			// 转换经度
			String longiLeft = longitude.substring(0, 3);
			String longiRight = longitude.substring(3);
			Integer longiLeftI = Integer.parseInt(longiLeft);
			Double longiRightD = Double.parseDouble(longiRight);
			Double longitudeNewD = longiLeftI + longiRightD / 60;
			String longitudeNew = longitudeNewD.toString();
			// 转换纬度
			String latiLeft = latitude.substring(0, 2);
			String latiRight = latitude.substring(2);
			Integer latiLeftI = Integer.parseInt(latiLeft);
			Double latiRightD = Double.parseDouble(latiRight);
			Double latitudeNewD = latiLeftI + latiRightD / 60;
			String latitudeNew = latitudeNewD.toString();
			// 更新
			sql = "update ptem_cips_test_data t set t.longitude='";
			sql += longitudeNew;
			sql += "'";
			sql += " ,t.latutide='";
			sql += latitudeNew;
			sql += "'";
			sql += ",t.islbconverted=1";
			sql += " where t.id='";
			sql += id;
			sql += "'";
			dbService.exeSql(sql);
		}
	}
	// public void updateCrossingTest1() throws IOException{
	// String sql="select t.id,t.crossingno from PTEM_CROSSING_TEST t";
	// List<Object[]> list=dbService.queryDataBySql(sql);
	// int num=list.size();
	// for(int i=0;i<num;i++)
	// {
	// Object objs[]=list.get(i);
	// String id=objs[0].toString();
	// String crossingno="";
	// if(objs[1]==null)
	// {
	// continue;
	// }
	// crossingno=objs[1].toString();
	// //穿跨越描述信息、穿越类型、穿越对象类型、穿越方式
	// sql="select
	// t.CROSSINGDESCRIPTION,t.CROSSINGTYPE,t.OBJECTTYPE,t.CROSSINGWAY";
	// sql+=" from PTEM_POINT_CROSSING t where t.CROSSINGNO='";
	// sql+=crossingno;
	// sql+="'";
	// List<Object[]> pipelinelist=dbService.queryDataBySql(sql);
	// Object objvalues[]=pipelinelist.get(0);
	// String crossingdescription="";
	// String crossingtype="";
	// String objecttype="";
	// String crossingway="";
	// if(objvalues[0]!=null)
	// {
	// crossingdescription=objvalues[0].toString();
	// }
	// if(objvalues[1]!=null)
	// {
	// crossingtype=objvalues[1].toString();
	// }
	// if(objvalues[2]!=null)
	// {
	// objecttype=objvalues[2].toString();
	// }
	// if(objvalues[3]!=null)
	// {
	// crossingway=objvalues[3].toString();
	// }
	// sql="update PTEM_CROSSING_TEST t set t.CROSSINGINFO='";
	// sql+=crossingdescription;
	// sql+="',t.CROSSINGTYPE='";
	// sql+=crossingtype;
	// sql+="',t.OBJECTTYPE='";
	// sql+=objecttype;
	// sql+="',t.CROSSINGWAY='";
	// sql+=crossingway;
	// sql+="' where t.id='";
	// sql+=id;
	// sql+="'";
	// dbService.exeSql(sql);
	// }
	// }
	//	
	// 更新管线表通气时间字段
	public void updatePipeLineField() throws IOException {
		String sql = "update ptem_pipeline t1 set t1.AERATEDATE = ";
		sql += "(select t2.AERATEDATE from PTEM_PROJECT_INFO t2 "
				+ "where t2.PROJECTNO=t1.PROJECTNO)";
		sql += " where t1.AERATEDATE is null";
		dbService.exeSql(sql);
	}
	public void updatePipeLineField(String ids) throws IOException {
		String sql = "update ptem_pipeline t1 set t1.AERATEDATE = ";
		sql += "(select t2.AERATEDATE from PTEM_PROJECT_INFO t2 "
				+ "where t2.PROJECTNO=t1.PROJECTNO)";
		sql += " where t1.AERATEDATE is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
	}
	// 更新管线长度
	public void updatePipelength() throws IOException {
		String sql = "select id,pipelineno from ptem_pipeline t where t.pipelineno is not null";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			String pipelineno = obj[1].toString();
			sql = "select t.PLANELENGTH from ptem_pipesection t where t.pipelineno='";
			sql += pipelineno;
			sql += "'";
			List<String> listlength = dbService.queryDataBySql(sql);
			int secnum = listlength.size();
			Double sumlength = 0.0;
			for (int j = 0; j < secnum; j++) {
				String strlength = listlength.get(j);
				Double length = Double.parseDouble(strlength);
				sumlength += length;
			}
			String strsumlength = sumlength.toString();
			sql = "update ptem_pipeline t set t.length='";
			sql += strsumlength;
			sql += "' where t.id='";
			sql += id;
			sql += "'";
			sql += " and t.length is null";
			dbService.exeSql(sql);
		}
	}
	public void updatePipelength(String ids) throws IOException {
		String sql = "select id,pipelineno from ptem_pipeline t where t.pipelineno is not null";
		sql+=" and t.id in("+ids+")";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			String pipelineno = obj[1].toString();
			sql = "select t.PLANELENGTH from ptem_pipesection t where t.pipelineno='";
			sql += pipelineno;
			sql += "'";
			List<String> listlength = dbService.queryDataBySql(sql);
			int secnum = listlength.size();
			Double sumlength = 0.0;
			for (int j = 0; j < secnum; j++) {
				String strlength = listlength.get(j);
				Double length = Double.parseDouble(strlength);
				sumlength += length;
			}
			String strsumlength = sumlength.toString();
			sql = "update ptem_pipeline t set t.length='";
			sql += strsumlength;
			sql += "' where t.id='";
			sql += id;
			sql += "'";
			sql += " and t.length is null";
			dbService.exeSql(sql);
		}
	}

	// 更新TSG压力级别
	public void updateTSG() throws IOException {
		String sql = "select t.id,t.MEDIA,t.DESIGNPRESSURE from PTEM_PIPELINE t";
		sql += " where t.media is not null or t.designpressure is not null";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] objs = list.get(i);
			String id = objs[0].toString(); // ID
			String media = "";
			String strdesignpressure = "";
			if (objs[1] != null) {
				media = objs[1].toString(); // 运行介质
			}
			if (objs[2] != null) {
				strdesignpressure = objs[2].toString(); // 设计压力
			}

			String TSG = ""; // TSG压力级别
			if (media.equals("液化石油气")) {
				TSG = "/";
			} else {
				if (strdesignpressure.equals("")) {
					continue;
				}
				// 设计压力
				Double designpressure = Double.parseDouble(strdesignpressure);
				if (designpressure > 2.5 && designpressure <= 4.0) {
					TSG = "GB1-I";
				} else if (designpressure > 1.6 && designpressure <= 2.5) {
					TSG = "GB1-II";
				} else if (designpressure > 0.8 && designpressure <= 1.6) {
					TSG = "GB1-III";
				} else if (designpressure > 0.4 && designpressure <= 0.8) {
					TSG = "GB1-IV";
				} else if (designpressure > 0.2 && designpressure <= 0.4) {
					TSG = "GB1-V";
				} else if (designpressure > 0.1 && designpressure <= 0.2) {
					TSG = "GB1-VI";
				}
			}
			sql = "update ptem_pipeline t set t.TSGPRESSURELEVEL='";
			sql += TSG;
			sql += "' where t.id='";
			sql += id;
			sql += "'";
			sql += " and t.TSGPRESSURELEVEL is null";
			dbService.exeSql(sql);
		}
	}
	public void updateTSG(String ids) throws IOException {
		String sql = "select t.id,t.MEDIA,t.DESIGNPRESSURE from PTEM_PIPELINE t";
		sql += " where (t.media is not null or t.designpressure is not null)";
		sql+=" and t.id in("+ids+")";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] objs = list.get(i);
			String id = objs[0].toString(); // ID
			String media = "";
			String strdesignpressure = "";
			if (objs[1] != null) {
				media = objs[1].toString(); // 运行介质
			}
			if (objs[2] != null) {
				strdesignpressure = objs[2].toString(); // 设计压力
			}

			String TSG = ""; // TSG压力级别
			if (media.equals("液化石油气")) {
				TSG = "/";
			} else {
				if (strdesignpressure.equals("")) {
					continue;
				}
				// 设计压力
				Double designpressure = Double.parseDouble(strdesignpressure);
				if (designpressure > 2.5 && designpressure <= 4.0) {
					TSG = "GB1-I";
				} else if (designpressure > 1.6 && designpressure <= 2.5) {
					TSG = "GB1-II";
				} else if (designpressure > 0.8 && designpressure <= 1.6) {
					TSG = "GB1-III";
				} else if (designpressure > 0.4 && designpressure <= 0.8) {
					TSG = "GB1-IV";
				} else if (designpressure > 0.2 && designpressure <= 0.4) {
					TSG = "GB1-V";
				} else if (designpressure > 0.1 && designpressure <= 0.2) {
					TSG = "GB1-VI";
				}
			}
			sql = "update ptem_pipeline t set t.TSGPRESSURELEVEL='";
			sql += TSG;
			sql += "' where t.id='";
			sql += id;
			sql += "'";
			sql += " and t.TSGPRESSURELEVEL is null";
			dbService.exeSql(sql);
		}
	}

	public void updatePipeSectionNoAll() throws IOException {
		// 更新特征点表中的管段编号
		updatePipeSectionNo("ptem_pipepoint", "pipesectionno", "locationx",
				"locationy");
	}

	// 更新地图经纬度
	public void updatePointLBMap(String tablename, String fieldl,
			String fieldb, String fieldlmap, String fieldbmap)
			throws IOException {
		GpsUtil gpsutil = new GpsUtil();
		//
		String sql="";
		sql = "select t.id,t." + fieldl + ",t." + fieldb + " from "
		+ tablename + " t where t." + fieldl + " is not null and t."
		+ fieldb + " is not null";
		sql+=" and t."+fieldlmap+" is null";
//		sql = "select t.id,t." + fieldl + ",t." + fieldb + " from "
//				+ tablename + " t where t." + fieldl + " is not null and t."
//				+ fieldb + " is not null";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {			
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			String strl = obj[1].toString();
			String strb = obj[2].toString();
			BLH blh = gpsutil.ReDefineGps(strl, strb);
			Double lmap = blh.L;
			Double bmap = blh.B;
			String strlmap = lmap.toString();
			String strbmap = bmap.toString();
			sql = "update " + tablename + " t set t." + fieldlmap + "='"
					+ strlmap + "',t." + fieldbmap + "='" + strbmap
					+ "' where t.id='" + id + "'";
			dbService.exeSql(sql);
		}
	}
	public void updatePointLBMap(String tablename, String fieldl,
			String fieldb, String fieldlmap, String fieldbmap,String ids)
			throws IOException {
		GpsUtil gpsutil = new GpsUtil();
		//
//		String sql = "select t.id,t." + fieldl + ",t." + fieldb + " from "
//				+ tablename + " t where t." + fieldl + " is not null and t."
//				+ fieldb + " is not null";
		
		String sql = "select t.id,t." + fieldl + ",t." + fieldb + " from "
		+ tablename + " t where t." + fieldl + " is not null and t."
		+ fieldb + " is not null";
		
		sql+=" and t.id in("+ids+")";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			String strl = obj[1].toString();
			String strb = obj[2].toString();
			BLH blh = gpsutil.ReDefineGps(strl, strb);
			Double lmap = blh.L;
			Double bmap = blh.B;
			String strlmap = lmap.toString();
			String strbmap = bmap.toString();
			sql = "update " + tablename + " t set t." + fieldlmap + "='"
					+ strlmap + "',t." + fieldbmap + "='" + strbmap
					+ "' where t.id='" + id + "'";
			dbService.exeSql(sql);
		}
	}
	// 更新点XY
	public void updatePointXY(String tablename, String fieldl, String fieldb,
			String fieldx, String fieldy) throws IOException {
		String sql = "select t.id,t." + fieldl + ",t." + fieldb + " from "
				+ tablename + " t where t." + fieldl + " is not null and t."
				+ fieldb + " is not null";
		sql+=" and (t."+fieldx+" is null or t."+fieldy+" is null)";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		CoordTranf coordTranf = new CoordTranf();
		Four_Par m4 = new Four_Par();// 这里定义的参数是从BL ---> xy的参数
		m4.dX = -4117827.9819;
		m4.dY = 87682.7697;
		m4.Cita = -0.41671168;// 这里输入单位应该是度，原来的-0.250016206100是dms单位
		m4.k = 0.999948651073;
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			String strl = obj[1].toString();
			String strb = obj[2].toString();
			Double l = Double.parseDouble(strl);
			Double b = Double.parseDouble(strb);
			BLH mBL = new BLH();
			mBL.L = l.doubleValue();// 单位度
			mBL.B = b.doubleValue();// 单位度
			xyh mxyh = coordTranf.BL2XY(mBL, 117, m4);
			Double x = mxyh.x;
			Double y = mxyh.y;
			String strx = x.toString();
			String stry = y.toString();
			sql = "update " + tablename + " t set t." + fieldx + "='" + strx
					+ "',t." + fieldy + "='" + stry + "'";
			sql += " where t.id='";
			sql += id;
			sql += "'";
			sql += " and (t." + fieldx + " is null or t." + fieldy
					+ " is null)";
			dbService.exeSql(sql);
		}
	}
	// 更新点XY部分
	public void updatePointXY(String tablename, String fieldl, String fieldb,
			String fieldx, String fieldy,String ids) throws IOException {
		String sql = "select t.id,t." + fieldl + ",t." + fieldb + " from "
				+ tablename + " t where t." + fieldl + " is not null and t."
				+ fieldb + " is not null";
		sql+=" and t.id in("+ids+")";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		CoordTranf coordTranf = new CoordTranf();
		Four_Par m4 = new Four_Par();// 这里定义的参数是从BL ---> xy的参数
		m4.dX = -4117827.9819;
		m4.dY = 87682.7697;
		m4.Cita = -0.41671168;// 这里输入单位应该是度，原来的-0.250016206100是dms单位
		m4.k = 0.999948651073;
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			String strl = obj[1].toString();
			String strb = obj[2].toString();
			Double l = Double.parseDouble(strl);
			Double b = Double.parseDouble(strb);
			BLH mBL = new BLH();
			mBL.L = l.doubleValue();// 单位度
			mBL.B = b.doubleValue();// 单位度
			xyh mxyh = coordTranf.BL2XY(mBL, 117, m4);
			Double x = mxyh.x;
			Double y = mxyh.y;
			String strx = x.toString();
			String stry = y.toString();
			sql = "update " + tablename + " t set t." + fieldx + "='" + strx
					+ "',t." + fieldy + "='" + stry + "'";
			sql += " where t.id='";
			sql += id;
			sql += "'";
			sql += " and (t." + fieldx + " is null or t." + fieldy
					+ " is null)";
			dbService.exeSql(sql);
		}
	}
	// 更新点经纬度
	public void updatePointLB(String tablename, String fieldl, String fieldb,
			String fieldx, String fieldy) throws IOException {
		CoordTranf coordTranf = new CoordTranf();
		Four_Par m4 = new Four_Par();// 这里定义的参数是从BL ---> xy的参数
		m4.dX = -4117827.9819;
		m4.dY = 87682.7697;
		m4.Cita = -0.41671168;// 这里输入单位应该是度，原来的-0.250016206100是dms单位
		m4.k = 0.999948651073;
		String sql = "select t.id,t." + fieldx + ",t." + fieldy + " from "
				+ tablename + " t where t." + fieldx + " is not null and t."
				+ fieldy + " is not null";
			  sql+=" and (t."+fieldl+" is null or t."+fieldb+" is null)";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			String strx = obj[1].toString();
			String stry = obj[2].toString();
			Double x = Double.parseDouble(strx);
			Double y = Double.parseDouble(stry);
			xyh mxyh = new xyh();
			mxyh.x = x.doubleValue();// 单位米
			mxyh.y = y.doubleValue();// 单位米
			BLH mBL = coordTranf.XY2BL(mxyh, 117, m4);
			Double l = mBL.L;
			Double b = mBL.B;
			String strl = l.toString();
			String strb = b.toString();
			sql = "update " + tablename + " t set t." + fieldl + "='" + strl
					+ "',t." + fieldb + "='" + strb + "'";
			sql += " where t.id='";
			sql += id;
			sql += "'";
			sql += " and (t." + fieldl + " is null or t." + fieldb
					+ " is null)";
			dbService.exeSql(sql);
		}
	}
	public void updatePointLB(String tablename, String fieldl, String fieldb,
			String fieldx, String fieldy,String ids) throws IOException {
		CoordTranf coordTranf = new CoordTranf();
		Four_Par m4 = new Four_Par();// 这里定义的参数是从BL ---> xy的参数
		m4.dX = -4117827.9819;
		m4.dY = 87682.7697;
		m4.Cita = -0.41671168;// 这里输入单位应该是度，原来的-0.250016206100是dms单位
		m4.k = 0.999948651073;
		String sql = "select t.id,t." + fieldx + ",t." + fieldy + " from "
				+ tablename + " t where t." + fieldx + " is not null and t."
				+ fieldy + " is not null";
		sql+=" and t.id in("+ids+")";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			String strx = obj[1].toString();
			String stry = obj[2].toString();
			Double x = Double.parseDouble(strx);
			Double y = Double.parseDouble(stry);
			xyh mxyh = new xyh();
			mxyh.x = x.doubleValue();// 单位米
			mxyh.y = y.doubleValue();// 单位米
			BLH mBL = coordTranf.XY2BL(mxyh, 117, m4);
			Double l = mBL.L;
			Double b = mBL.B;
			String strl = l.toString();
			String strb = b.toString();
			sql = "update " + tablename + " t set t." + fieldl + "='" + strl
					+ "',t." + fieldb + "='" + strb + "'";
			sql += " where t.id='";
			sql += id;
			sql += "'";
			sql += " and (t." + fieldl + " is null or t." + fieldb
					+ " is null)";
			dbService.exeSql(sql);
		}
	}
//	// 更新管网编号
//	public void updatePipeSectionNo(String tablename, String fieldname,
//			String fieldx, String fieldy) throws IOException {
//		String sql;
//		sql = "select t.id,t." + fieldx + ",t." + fieldy + " from " + tablename
//				+ " t";
//		sql += " where t." + fieldx + " is not null and t." + fieldy
//				+ " is not null";
//		sql+=" and t."+fieldname+" is null";
//		List<Object[]> list = dbService.queryDataBySql(sql);
//		int num = list.size();
//		for (int i = 0; i < num; i++) {
//			Object[] data = list.get(i);
//			String id = data[0].toString();
//			String x = data[1].toString();
//			String y = data[2].toString();
//			sql = "select t.pipesectionno,pointtoline(t.beginnodex,t.beginnodey,t.endnodex,t.endnodey,"
//					+ x + "," + y + ")from ptem_pipesection t";
//			List<Object[]> listdis = dbService.queryDataBySql(sql);
//			int disnum = listdis.size();
//			String strdis = listdis.get(0)[1].toString();
//			Double dis = Double.parseDouble(strdis);
//			Double dismin = dis;
//			int indexmin = 0;
//			for (int j = 1; j < disnum; j++) {
//				strdis = listdis.get(j)[1].toString();
//				dis = Double.parseDouble(strdis);
//				if (dis < dismin) {
//					dismin = dis;
//					indexmin = j;
//				}
//			}
//			String pipesectionno = listdis.get(indexmin)[0].toString();
//			sql = "update " + tablename + " t set t." + fieldname + " ='";
//			sql += pipesectionno;
//			sql += "'where t.id='";
//			sql += id;
//			sql += "'";
//			sql += " and t.";
//			sql += fieldname;
//			sql += " is null";
//			dbService.exeSql(sql);
//		}
//	}
	// 更新管网编号
	public void updatePipeSectionNo(String tablename, String fieldname,
			String fieldx, String fieldy) throws IOException {
		String sql;
		sql = "select t.id,t." + fieldx + ",t." + fieldy + " from " + tablename
				+ " t";
		sql += " where t." + fieldx + " is not null and t." + fieldy
				+ " is not null";
		sql+=" and t."+fieldname+" is null";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] data = list.get(i);
			String id = data[0].toString();
			String x = data[1].toString();
			String y = data[2].toString();
			sql = "select t.pipesectionno,pointtoline(t.beginnodex,t.beginnodey,t.endnodex,t.endnodey,"
					+ x + "," + y + ") as distance from ptem_pipesection t order by distance asc";
			List<Object[]> listdis = dbService.queryDataBySql(sql);
			int disnum = listdis.size();
			if(disnum!=0)
			{
				String pipesectionno = listdis.get(0)[0].toString();
				sql = "update " + tablename + " t set t." + fieldname + " ='";
				sql += pipesectionno;
				sql += "'where t.id='";
				sql += id;
				sql += "'";
				sql += " and t.";
				sql += fieldname;
				sql += " is null";
				dbService.exeSql(sql);
			}		
		}
	}
	public void updatePipeSectionNo(String tablename, String fieldname,
			String fieldx, String fieldy,String ids) throws IOException {
		String sql;
		sql = "select t.id,t." + fieldx + ",t." + fieldy + " from " + tablename
				+ " t";
		sql += " where t." + fieldx + " is not null and t." + fieldy
				+ " is not null";
		sql+=" and t.id in("+ids+")";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] data = list.get(i);
			String id = data[0].toString();
			String x = data[1].toString();
			String y = data[2].toString();
			sql = "select t.pipesectionno,pointtoline(t.beginnodex,t.beginnodey,t.endnodex,t.endnodey,"
					+ x + "," + y + ")from ptem_pipesection t";
			List<Object[]> listdis = dbService.queryDataBySql(sql);
			int disnum = listdis.size();
			String strdis = listdis.get(0)[1].toString();
			Double dis = Double.parseDouble(strdis);
			Double dismin = dis;
			int indexmin = 0;
			for (int j = 1; j < disnum; j++) {
				strdis = listdis.get(j)[1].toString();
				dis = Double.parseDouble(strdis);
				if (dis < dismin) {
					dismin = dis;
					indexmin = j;
				}
			}
			String pipesectionno = listdis.get(indexmin)[0].toString();
			sql = "update " + tablename + " t set t." + fieldname + " ='";
			sql += pipesectionno;
			sql += "'where t.id='";
			sql += id;
			sql += "'";
			sql += " and t.";
			sql += fieldname;
			sql += " is null";
			dbService.exeSql(sql);
		}
	}

	// 更新工程项目编号
	public void updateProjectno(String tablename) throws IOException {
		// 更新工程项目编号
		String sql = "update " + tablename + " t1 set t1.projectno="
				+ "(select t2.projectno from ptem_pipeline t2 "
				+ "where t2.pipelineno=t1.pipelineno)";
		sql += "where t1.projectno is null";
		dbService.exeSql(sql);
	}
	public void updateProjectno(String tablename,String ids) throws IOException {
		// 更新工程项目编号
		String sql = "update " + tablename + " t1 set t1.projectno="
				+ "(select t2.projectno from ptem_pipeline t2 "
				+ "where t2.pipelineno=t1.pipelineno)";
		sql += "where t1.projectno is null";
		sql+="";
		sql+=" and t1.id in("+ids+")";
	}
	// 更新工程项目编号管线编号为多个的
	public void updateProjectnoMul(String tablename) throws IOException {
		// 更新工程项目编号
		String sql = "select t.id,t.pipelineno from " + tablename
				+ " t where t.pipelineno is not null";
		// " t where t.pipelineno is not null and t.projectno is null";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			String pipelineno = obj[1].toString();
			pipelineno.replace("；", ",");
			sql = "select t.projectno from ptem_pipeline t where t.pipelineno in(";
			sql += pipelineno + ")";
			List<String> listprojectno = dbService.queryDataBySql(sql);
			String projectno = "";
			int projectnonum = listprojectno.size();
			for (int j = 0; j < projectnonum; j++) {
				if(listprojectno.get(j)!=null)
				{
					projectno += listprojectno.get(j);
					projectno += "；";
				}	
			}
			if(!projectno.equals(""))
			{
				projectno = projectno.substring(0, projectno.length() - 1);
			}			
			sql = "update " + tablename + " t set t.projectno='" + projectno
					+ "'";
			sql += "where t.id='" + id + "'";
			sql += " and t.projectno is null";
			dbService.exeSql(sql);
		}
	}
	// 更新工程项目编号管线编号为多个的部分
	public void updateProjectnoMul(String tablename,String ids) throws IOException {
		// 更新工程项目编号
		String sql = "select t.id,t.pipelineno from " + tablename
				+ " t where t.pipelineno is not null";
		// " t where t.pipelineno is not null and t.projectno is null";
		sql+=" and t.id in("+ids+")";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			String pipelineno = obj[1].toString();
			pipelineno.replace("；", ",");
			sql = "select t.projectno from ptem_pipeline t where t.pipelineno in(";
			sql += pipelineno + ")";
			List<String> listprojectno = dbService.queryDataBySql(sql);
			String projectno = "";
			int projectnonum = listprojectno.size();
			for (int j = 0; j < projectnonum; j++) {
				if(listprojectno.get(j)!=null)
				{
					projectno += listprojectno.get(j);
					projectno += "；";
				}	
			}
			if(!projectno.equals(""))
			{
				projectno = projectno.substring(0, projectno.length() - 1);
			}	
			sql = "update " + tablename + " t set t.projectno='" + projectno
					+ "'";
			sql += "where t.id='" + id + "'";
			sql += " and t.projectno is null";
			dbService.exeSql(sql);
		}
	}
	// 更新站箱名称
	public void updateStationname(String tablename) throws IOException {
		String sql = "update "
				+ tablename
				+ " t1 set t1.STATIONNAME=(select t2.STATIONNAME from PTEM_STATION t2 where t2.PIPENO=t1.PIPENETNO)";
		sql += " where t1.STATIONNAME is null";
		dbService.exeSql(sql);
	}

	// 更新表A工程项目信息
	public void updateProjectInfo() throws IOException {
		// 经纬度
		updatePointLB("PTEM_PROJECT_INFO", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEX", "BEGINNODEY");
		updatePointLB("PTEM_PROJECT_INFO", "ENDNODEL", "ENDNODEB", "ENDNODEX",
				"ENDNODEY");
		// 地图经纬度
		updatePointLBMap("PTEM_PROJECT_INFO", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEL_map", "BEGINNODEB_map");
		updatePointLBMap("PTEM_PROJECT_INFO", "ENDNODEL", "ENDNODEB",
				"ENDNODEL_map", "ENDNODEB_map");
		
//		String sql;
//		sql="select distinct code_id from tdm_attachment ";
//		List<Object> list=dbService.queryDataBySql(sql);
//		int num=list.size();
//		for(int i=0;i<num;i++)
//		{
//			if(list.get(i)==null)
//			{
//				continue;
//			}
//			String code_id=list.get(i).toString();
//			sql="select t.file_name from tdm_attachment t where t.code_id=";
//			sql+=code_id;
//			List<String> listFilename=dbService.queryDataBySql(sql);
//			int filenum=listFilename.size();
//			String filenames="";
//			for(int j=0;j<filenum;j++)
//			{
//				if(listFilename.get(j)!=null&&listFilename.get(j)!="")
//				{
//					filenames+=listFilename.get(j);
//					filenames+="；";
//				}
//			}
//			if(filenames.length()>0)
//			{
//				filenames=filenames.substring(0,filenames.length()-1);
//			}
//			sql="insert into PTEM_ATTACHMENT(ID,code_id,file_name)" +
//					"values(SEQ_PTEM_ATTACHMENT.nextval,"+code_id+",'";
//			sql+=filenames+"')";
//			dbService.exeSql(sql);
//		}
	}
	public void updateProjectInfo(String ids) throws IOException {
		// 经纬度
		updatePointLB("PTEM_PROJECT_INFO", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEX", "BEGINNODEY",ids);
		updatePointLB("PTEM_PROJECT_INFO", "ENDNODEL", "ENDNODEB", "ENDNODEX",
				"ENDNODEY",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_PROJECT_INFO", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEL_map", "BEGINNODEB_map",ids);
		updatePointLBMap("PTEM_PROJECT_INFO", "ENDNODEL", "ENDNODEB",
				"ENDNODEL_map", "ENDNODEB_map",ids);
	}
	// 更新B管线表
	public String updatePipeLine() throws IOException {
		// 更新管线节点表
		String strres="success";
//		int res=updatePipeLineCoord();
//		if(res!=0)
//		{
//			strres="请先更新管段表";
//			return strres;
//		}
		String sql="select count(1) from ptem_pipesection ";		
		List<Object> list=dbService.queryDataBySql(sql);
		String numall=list.get(0).toString();
		sql="select count(1) from ptem_pipesection t where t.pipelineno is not null";
		sql+=" and t.PLANELENGTH is not null";
		List<Object> listupdate=dbService.queryDataBySql(sql);
		String numupdate=listupdate.get(0).toString();
		if(!numupdate.equals(numall))
		{
			strres="请先更新管段表";
			return strres;
		}
		// 更新通气时间
		updatePipeLineField();
		// 更新管线长度
		updatePipelength();
		// 更新表B管线中的TSG压力级制
		updateTSG();
		
		
		return strres;
	}
	public String updatePipeLine(String ids) throws IOException {
		String strres="success";
		String sql="select count(1) from ptem_pipesection ";		
		List<Object> list=dbService.queryDataBySql(sql);
		String numall=list.get(0).toString();
		sql="select count(1) from ptem_pipesection t where t.pipelineno is not null";
		sql+=" and t.PLANELENGTH is not null";
		List<Object> listupdate=dbService.queryDataBySql(sql);
		String numupdate=listupdate.get(0).toString();
		if(!numupdate.equals(numall))
		{
			strres="请先更新管段表";
			return strres;
		}
		// 更新通气时间
		updatePipeLineField(ids);
		// 更新管线长度
		updatePipelength(ids);
		// 更新表B管线中的TSG压力级制
		updateTSG(ids);
		// 更新管线节点表
		//updatePipeLineCoord(ids);
		// 更新管线节点表中地图经纬度
		updatePointLBMap("ptem_pipeline_node", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEL_map", "BEGINNODEB_map",ids);
		updatePointLBMap("ptem_pipeline_node", "ENDNODEL", "ENDNODEB",
				"ENDNODEL_map", "ENDNODEB_map",ids);
		return strres;
	}

	// 更新C管段表
	public void updatePipeSection() throws IOException {
		// 更新管线编号
		updatePipeLineNo("ptem_pipesection", "PIPESECTIONNO");	
		// 更新继承自管线表中的字段
		updatePipeSectionFromPipeline();
		// 更新管段长度
		updatePipeSectionLength();
		// 判断立管和重复
		updateJudgerepeat();
		// 经纬度
		updatePointLB("ptem_pipesection", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEX", "BEGINNODEY");
		updatePointLB("ptem_pipesection", "ENDNODEL", "ENDNODEB", "ENDNODEX",
				"ENDNODEY");
		// 地图经纬度
		updatePointLBMap("ptem_pipesection", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEL_map", "BEGINNODEB_map");
		updatePointLBMap("ptem_pipesection", "ENDNODEL", "ENDNODEB",
				"ENDNODEL_map", "ENDNODEB_map");
		//更新缩略图节点坐标
		updatePipeLineCoordNode();
		// 更新管线节点表中地图经纬度
		updatePointLBMap("ptem_pipeline_node", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEL_map", "BEGINNODEB_map");
		updatePointLBMap("ptem_pipeline_node", "ENDNODEL", "ENDNODEB",
				"ENDNODEL_map", "ENDNODEB_map");
	}
	public void updatePipeSection(String ids) throws IOException {
		// 更新管线编号
		updatePipeLineNo("ptem_pipesection", "PIPESECTIONNO",ids);
		// 更新继承自管线表中的字段
		updatePipeSectionFromPipeline(ids);
		// 更新管段长度
		updatePipeSectionLength(ids);
		// 判断立管和重复
		updateJudgerepeat(ids);
		// 经纬度
		updatePointLB("ptem_pipesection", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEX", "BEGINNODEY",ids);
		updatePointLB("ptem_pipesection", "ENDNODEL", "ENDNODEB", "ENDNODEX",
				"ENDNODEY",ids);
		// 地图经纬度
		updatePointLBMap("ptem_pipesection", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEL_map", "BEGINNODEB_map",ids);
		updatePointLBMap("ptem_pipesection", "ENDNODEL", "ENDNODEB",
				"ENDNODEL_map", "ENDNODEB_map",ids);
	}

	// 更新C-1特征点表
	public void updatePipePoint() throws IOException {
		// 管网编号
		updatePipeSectionNo("ptem_pipepoint", "pipesectionno", "locationx",
				"locationy");
		// 管线编号
		updatePipeLineNo("ptem_pipepoint", "pipesectionno");
		// 特征点编号
		updatePointNo("ptem_pipepoint", "pointno", "TSD");
		// 经纬度
		updatePointLB("ptem_pipepoint", "longitude", "latitude", "locationx",
				"locationy");
		// 地图经纬度
		updatePointLBMap("ptem_pipepoint", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	
	// 更新C-1特征点表
	public void updatePipePoint(String ids) throws IOException {
		// 管网编号
		updatePipeSectionNo("ptem_pipepoint", "pipesectionno", "locationx",
				"locationy",ids);
		// 管线编号
		updatePipeLineNo("ptem_pipepoint", "pipesectionno",ids);
		// 特征点编号
		updatePointNo("ptem_pipepoint", "pointno", "TSD",ids);
		// 经纬度
		updatePointLB("ptem_pipepoint", "longitude", "latitude", "locationx",
				"locationy",ids);
		// 地图经纬度
		updatePointLBMap("ptem_pipepoint", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}

	// 更新C-2三通表
	public void updatePointTee() throws IOException {
		// 管网编号
		updatePipeSectionNo("ptem_point_tee", "pipesectionno", "locationx",
				"locationy");
		// 管线编号
		updatePipeLineNo("ptem_point_tee", "pipesectionno");
		// 三通编号
		updatePointNo("ptem_point_tee", "teeno", "ST");
		// 经纬度
		updatePointLB("ptem_point_tee", "longitude", "latitude", "locationx",
				"locationy");
		// 地图经纬度
		updatePointLBMap("ptem_point_tee", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	public void updatePointTee(String ids) throws IOException {
		// 管网编号
		updatePipeSectionNo("ptem_point_tee", "pipesectionno", "locationx",
				"locationy",ids);
		// 管线编号
		updatePipeLineNo("ptem_point_tee", "pipesectionno",ids);
		// 三通编号
		updatePointNo("ptem_point_tee", "teeno", "ST",ids);
		// 经纬度
		updatePointLB("ptem_point_tee", "longitude", "latitude", "locationx",
				"locationy",ids);
		// 地图经纬度
		updatePointLBMap("ptem_point_tee", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}
	// 更新C-3阳极表	
	public void updatePointAnode() throws IOException {
		// 管网编号
		updatePipeSectionNo("ptem_point_anode", "pipesectionno", "locationx",
				"locationy");
		// 管线编号
		updatePipeLineNo("ptem_point_anode", "pipesectionno");
		// 阳极编号
		updatePointNo("ptem_point_anode", "anodeno", "YJ");
		// 经纬度
		updatePointLB("ptem_point_anode", "longitude", "latitude", "locationx",
				"locationy");
		// 地图经纬度
		updatePointLBMap("ptem_point_anode", "longitude", "latitude",
				"longitude_map", "latitude_map");

	}
	// 更新C-3阳极表部分	
	public void updatePointAnode(String ids) throws IOException {
		// 管网编号
		updatePipeSectionNo("ptem_point_anode", "pipesectionno", "locationx",
				"locationy",ids);
		// 管线编号
		updatePipeLineNo("ptem_point_anode", "pipesectionno",ids);
		// 阳极编号
		updatePointNo("ptem_point_anode", "anodeno", "YJ",ids);
		// 经纬度
		updatePointLB("ptem_point_anode", "longitude", "latitude", "locationx",
				"locationy",ids);
		// 地图经纬度
		updatePointLBMap("ptem_point_anode", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);

	}
	// 更新表C-4测试桩
	public void updatePointPole() throws IOException {
		// 管网编号
		updatePipeSectionNo("ptem_point_pole", "pipesectionno", "locationx",
				"locationy");
		// 管线编号
		updatePipeLineNo("ptem_point_pole", "pipesectionno");
		// 测试桩编号 改为手动生成
		//updatePointNo("ptem_point_pole", "poleno", "CSZ");
		// 更新工程项目编号
		updateProjectno("ptem_point_pole");
		// 经纬度
		updatePointLB("ptem_point_pole", "longitude", "latitude", "locationx",
				"locationy");
		// 地图经纬度
		updatePointLBMap("ptem_point_pole", "longitude", "latitude",
				"longitude_map", "latitude_map");

	}
	// 更新表C-4测试桩部分
	public void updatePointPole(String ids) throws IOException {
		// 管网编号
		updatePipeSectionNo("ptem_point_pole", "pipesectionno", "locationx",
				"locationy",ids);
		// 管线编号
		updatePipeLineNo("ptem_point_pole", "pipesectionno",ids);
		// 测试桩编号
		updatePointNo("ptem_point_pole", "poleno", "CSZ",ids);
		// 更新工程项目编号
		updateProjectno("ptem_point_pole",ids);
		// 经纬度
		updatePointLB("ptem_point_pole", "longitude", "latitude", "locationx",
				"locationy",ids);
		// 地图经纬度
		updatePointLBMap("ptem_point_pole", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);

	}
	// 更新表C-5排流装置
	public void updatePointDrainage() throws IOException {
		// 管网编号
		updatePipeSectionNo("ptem_point_drainage", "pipesectionno",
				"locationx", "locationy");
		// 管线编号
		updatePipeLineNo("ptem_point_drainage", "pipesectionno");
		// 排流装置编号
		updatePointNo("ptem_point_drainage", "DRAINAGECODE", "PLZZ");
		// 经纬度
		updatePointLB("ptem_point_drainage", "longitude", "latitude",
				"locationx", "locationy");
		// 地图经纬度
		updatePointLBMap("ptem_point_drainage", "longitude", "latitude",
				"longitude_map", "latitude_map");

	}
	// 更新表C-5排流装置部分
	public void updatePointDrainage(String ids) throws IOException {
		// 管网编号
		updatePipeSectionNo("ptem_point_drainage", "pipesectionno",
				"locationx", "locationy",ids);
		// 管线编号
		updatePipeLineNo("ptem_point_drainage", "pipesectionno",ids);
		// 排流装置编号
		updatePointNo("ptem_point_drainage", "DRAINAGECODE", "PLZZ",ids);
		// 经纬度
		updatePointLB("ptem_point_drainage", "longitude", "latitude",
				"locationx", "locationy",ids);
		// 地图经纬度
		updatePointLBMap("ptem_point_drainage", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);

	}
	// 更新表C-6穿跨越
	public void updatePointCrossing() throws IOException {
		// 管线编号
		updatePipeLineNo("ptem_point_crossing", "pipeno");
		// 穿跨越编号
		updatePointNo("ptem_point_crossing", "crossingno", "CKY");
		// 更新工程项目编号
		updateProjectno("ptem_point_crossing");
		// 经纬度
		updatePointLB("ptem_point_crossing", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEX", "BEGINNODEY");
		updatePointLB("ptem_point_crossing", "ENDNODEL", "ENDNODEB",
				"ENDNODEX", "ENDNODEY");
		// 地图经纬度
		updatePointLBMap("ptem_point_crossing", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEL_map", "BEGINNODEB_map");
		updatePointLBMap("ptem_point_crossing", "ENDNODEL", "ENDNODEB",
				"ENDNODEL_map", "ENDNODEB_map");
	}
	// 更新表C-6穿跨越部分
	public void updatePointCrossing(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("ptem_point_crossing", "pipeno",ids);
		// 穿跨越编号
		updatePointNo("ptem_point_crossing", "crossingno", "CKY",ids);
		// 更新工程项目编号
		updateProjectno("ptem_point_crossing",ids);
		// 经纬度
		updatePointLB("ptem_point_crossing", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEX", "BEGINNODEY",ids);
		updatePointLB("ptem_point_crossing", "ENDNODEL", "ENDNODEB",
				"ENDNODEX", "ENDNODEY",ids);
		// 地图经纬度
		updatePointLBMap("ptem_point_crossing", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEL_map", "BEGINNODEB_map",ids);
		updatePointLBMap("ptem_point_crossing", "ENDNODEL", "ENDNODEB",
				"ENDNODEL_map", "ENDNODEB_map",ids);
	}
	// 更新套管长度
	public void updateCasingLength() throws IOException {
		// 更新套管长度
		String sql = "select t.id,t.beginnodey,t.endnodey,t.beginnodex,t.endnodex "
				+ "from ptem_point_casing t where t.beginnodey is not null and "
				+ "t.endnodey is not null and t.beginnodex is not null and "
				+ "t.endnodex is not null";
		List list = dbService.queryDataBySql(sql);
		for (int i = 0; i < list.size(); i++) {
			Object[] objs = (Object[]) list.get(i);
			String strID = (String) objs[0];
			double y1 = Double.parseDouble(objs[1].toString());
			double y2 = Double.parseDouble(objs[2].toString());
			double x1 = Double.parseDouble(objs[3].toString());
			double x2 = Double.parseDouble(objs[4].toString());
			double planeLength = getPlaneLength(y1, y2, x1, x2);
			String strPlaneLength = Double.toString(planeLength);
			sql = "update ptem_point_casing t set t.casinglength="
					+ strPlaneLength;
			// sql+=" where t.id='"+strID+"'";
			sql += " where t.casinglength is null";
			sql += " and t.id='" + strID + "'";
			dbService.exeSql(sql);
		}
	}
	// 更新套管长度部分
	public void updateCasingLength(String ids) throws IOException {
		// 更新套管长度
		String sql = "select t.id,t.beginnodey,t.endnodey,t.beginnodex,t.endnodex "
				+ "from ptem_point_casing t where t.beginnodey is not null and "
				+ "t.endnodey is not null and t.beginnodex is not null and "
				+ "t.endnodex is not null";
		sql+=" and t.id in("+ids+")";
		List list = dbService.queryDataBySql(sql);
		for (int i = 0; i < list.size(); i++) {
			Object[] objs = (Object[]) list.get(i);
			String strID = (String) objs[0];
			double y1 = Double.parseDouble(objs[1].toString());
			double y2 = Double.parseDouble(objs[2].toString());
			double x1 = Double.parseDouble(objs[3].toString());
			double x2 = Double.parseDouble(objs[4].toString());
			double planeLength = getPlaneLength(y1, y2, x1, x2);
			String strPlaneLength = Double.toString(planeLength);
			sql = "update ptem_point_casing t set t.casinglength="
					+ strPlaneLength;
			// sql+=" where t.id='"+strID+"'";
			sql += " where t.casinglength is null";
			sql += " and t.id='" + strID + "'";
			dbService.exeSql(sql);
		}
	}

	// 更新表C-7套管
	public void updatePointCasing() throws IOException {
		// 管线编号
		updatePipeLineNo("ptem_point_casing", "pipeno");
		// 套管编号
		updatePointNo("ptem_point_casing", "casingno", "TG");
		// 更新套管长度
		updateCasingLength();
		// 经纬度
		updatePointLB("ptem_point_casing", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEX", "BEGINNODEY");
		updatePointLB("ptem_point_casing", "ENDNODEL", "ENDNODEB", "ENDNODEX",
				"ENDNODEY");
		// 地图经纬度
		updatePointLBMap("ptem_point_casing", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEL_map", "BEGINNODEB_map");
		updatePointLBMap("ptem_point_casing", "ENDNODEL", "ENDNODEB",
				"ENDNODEL_map", "ENDNODEB_map");
	}
	// 更新表C-7套管部分
	public void updatePointCasing(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("ptem_point_casing", "pipeno",ids);
		// 套管编号
		updatePointNo("ptem_point_casing", "casingno", "TG",ids);
		// 更新套管长度
		updateCasingLength(ids);
		// 经纬度
		updatePointLB("ptem_point_casing", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEX", "BEGINNODEY",ids);
		updatePointLB("ptem_point_casing", "ENDNODEL", "ENDNODEB", "ENDNODEX",
				"ENDNODEY",ids);
		// 地图经纬度
		updatePointLBMap("ptem_point_casing", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEL_map", "BEGINNODEB_map",ids);
		updatePointLBMap("ptem_point_casing", "ENDNODEL", "ENDNODEB",
				"ENDNODEL_map", "ENDNODEB_map",ids);
	}

	// 更新表C-8弯管
	public void updatePointBend() throws IOException {
		// 管线编号
		updatePipeLineNo("ptem_point_bend", "pipesectionno");
		// 弯管编号
		updatePointNo("ptem_point_bend", "bendno", "WG");
		// 经纬度
		updatePointLB("ptem_point_bend", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEX", "BEGINNODEY");
		updatePointLB("ptem_point_bend", "ENDNODEL", "ENDNODEB", "ENDNODEX",
				"ENDNODEY");
		// 地图经纬度
		updatePointLBMap("ptem_point_bend", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEL_map", "BEGINNODEB_map");
		updatePointLBMap("ptem_point_bend", "ENDNODEL", "ENDNODEB",
				"ENDNODEL_map", "ENDNODEB_map");
	}
	// 更新表C-8弯管部分
	public void updatePointBend(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("ptem_point_bend", "pipesectionno",ids);
		// 弯管编号
		updatePointNo("ptem_point_bend", "bendno", "WG",ids);
		// 经纬度
		updatePointLB("ptem_point_bend", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEX", "BEGINNODEY",ids);
		updatePointLB("ptem_point_bend", "ENDNODEL", "ENDNODEB", "ENDNODEX",
				"ENDNODEY",ids);
		// 地图经纬度
		updatePointLBMap("ptem_point_bend", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEL_map", "BEGINNODEB_map",ids);
		updatePointLBMap("ptem_point_bend", "ENDNODEL", "ENDNODEB",
				"ENDNODEL_map", "ENDNODEB_map",ids);
	}
	// 更新表C-9内衬
	public void updatePointLiner() throws IOException {
		// 更新工程项目编号
		updateProjectnoMul("ptem_point_liner");
		// 更新内衬编号
		updateLinerNo("ptem_point_liner", "LINERNO", "TJSNC");
		// 经纬度
		updatePointLB("ptem_point_liner", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEX", "BEGINNODEY");
		updatePointLB("ptem_point_liner", "ENDNODEL", "ENDNODEB", "ENDNODEX",
				"ENDNODEY");
		// 地图经纬度
		updatePointLBMap("ptem_point_liner", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEL_map", "BEGINNODEB_map");
		updatePointLBMap("ptem_point_liner", "ENDNODEL", "ENDNODEB",
				"ENDNODEL_map", "ENDNODEB_map");

	}
	// 更新表C-9内衬部分
	public void updatePointLiner(String ids) throws IOException {
		// 更新工程项目编号
		updateProjectnoMul("ptem_point_liner",ids);
		// 更新内衬编号
		updateLinerNo("ptem_point_liner", "LINERNO", "TJSNC",ids);
		// 经纬度
		updatePointLB("ptem_point_liner", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEX", "BEGINNODEY",ids);
		updatePointLB("ptem_point_liner", "ENDNODEL", "ENDNODEB", "ENDNODEX",
				"ENDNODEY",ids);
		// 地图经纬度
		updatePointLBMap("ptem_point_liner", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEL_map", "BEGINNODEB_map",ids);
		updatePointLBMap("ptem_point_liner", "ENDNODEL", "ENDNODEB",
				"ENDNODEL_map", "ENDNODEB_map",ids);

	}
	// 更新表D阀门
	public void updateValve() throws IOException {
		// 管线编号
		updatePipeLineNo("ptem_valve", "pipeno");
		// 更新工程项目编号
		updateProjectno("ptem_valve");
		// 经纬度
		updatePointLB("ptem_valve", "longitude", "latitude", "locationx",
				"locationy");
		// 地图经纬度
		updatePointLBMap("ptem_valve", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	// 更新表D阀门部分
	public void updateValve(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("ptem_valve", "pipeno",ids);
		// 更新工程项目编号
		updateProjectno("ptem_valve",ids);
		// 经纬度
		updatePointLB("ptem_valve", "longitude", "latitude", "locationx",
				"locationy",ids);
		// 地图经纬度
		updatePointLBMap("ptem_valve", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}
	// 更新表E站箱
	public void updateStation() throws IOException {
		// 管线编号 手动填
		// updatePipeLineNo("ptem_station","pipeno");
		// 更新工程项目编号
		updateProjectno("ptem_station");
		// 经纬度
		updatePointLB("ptem_station", "longitude", "latitude", "locationx",
				"locationy");
		// 地图经纬度
		updatePointLBMap("ptem_station", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	// 更新表E站箱部分
	public void updateStation(String ids) throws IOException {
		// 管线编号 手动填
		// updatePipeLineNo("ptem_station","pipeno");
		// 更新工程项目编号
		updateProjectno("ptem_station",ids);
		// 经纬度
		updatePointLB("ptem_station", "longitude", "latitude", "locationx",
				"locationy",ids);
		// 地图经纬度
		updatePointLBMap("ptem_station", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}

	// 更新表E-1过滤器
	public void updateFilter() throws IOException {
		// 站箱名称
		String sql = "update ptem_filter t1 set t1.stationname="
				+ "(select t2.stationname from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.stationname is null";
		// String sql="update ptem_filter t1 set t1.stationname=" +
		// "(select t2.stationname from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 坐标y
		sql = "update ptem_filter t1 set t1.locationy="
				+ "(select t2.locationy from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.locationy is null";
		// sql="update ptem_filter t1 set t1.locationy=" +
		// "(select t2.locationy from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 坐标x
		sql = "update ptem_filter t1 set t1.locationx="
				+ "(select t2.locationx from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.locationx is null";
		// sql="update ptem_filter t1 set t1.locationx=" +
		// "(select t2.locationx from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 高程h
		sql = "update ptem_filter t1 set t1.height="
				+ "(select t2.height from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.height is null";
		// sql="update ptem_filter t1 set t1.height=" +
		// "(select t2.height from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 经度L
		sql = "update ptem_filter t1 set t1.longitude="
				+ "(select t2.longitude from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.longitude is null";
		// sql="update ptem_filter t1 set t1.longitude=" +
		// "(select t2.longitude from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 纬度B
		sql = "update ptem_filter t1 set t1.latitude="
				+ "(select t2.latitude from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.latitude is null";
		// sql="update ptem_filter t1 set t1.latitude=" +
		// "(select t2.latitude from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 椭球高H
		sql = "update ptem_filter t1 set t1.ellipseh="
				+ "(select t2.ellipseh from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.ellipseh is null";
		// sql="update ptem_filter t1 set t1.ellipseh=" +
		// "(select t2.ellipseh from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno) ";
		dbService.exeSql(sql);
		// 管线编号
		sql = "update ptem_filter t1 set t1.pipelineno="
				+ "(select t2.pipelineno from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.pipelineno is null";
		// sql="update ptem_filter t1 set t1.pipelineno=" +
		// "(select t2.pipelineno from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 地图经纬度
		updatePointLBMap("ptem_filter", "longitude", "latitude",
				"longitude_map", "latitude_map");

	}
	// 更新表E-1过滤器部分
	public void updateFilter(String ids) throws IOException {
		// 站箱名称
		String sql = "update ptem_filter t1 set t1.stationname="
				+ "(select t2.stationname from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.stationname is null";
		sql+=" and t1.id in("+ids+")";
		// String sql="update ptem_filter t1 set t1.stationname=" +
		// "(select t2.stationname from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 坐标y
		sql = "update ptem_filter t1 set t1.locationy="
				+ "(select t2.locationy from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.locationy is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update ptem_filter t1 set t1.locationy=" +
		// "(select t2.locationy from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 坐标x
		sql = "update ptem_filter t1 set t1.locationx="
				+ "(select t2.locationx from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.locationx is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update ptem_filter t1 set t1.locationx=" +
		// "(select t2.locationx from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 高程h
		sql = "update ptem_filter t1 set t1.height="
				+ "(select t2.height from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.height is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update ptem_filter t1 set t1.height=" +
		// "(select t2.height from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 经度L
		sql = "update ptem_filter t1 set t1.longitude="
				+ "(select t2.longitude from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.longitude is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update ptem_filter t1 set t1.longitude=" +
		// "(select t2.longitude from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 纬度B
		sql = "update ptem_filter t1 set t1.latitude="
				+ "(select t2.latitude from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.latitude is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update ptem_filter t1 set t1.latitude=" +
		// "(select t2.latitude from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 椭球高H
		sql = "update ptem_filter t1 set t1.ellipseh="
				+ "(select t2.ellipseh from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.ellipseh is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update ptem_filter t1 set t1.ellipseh=" +
		// "(select t2.ellipseh from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno) ";
		dbService.exeSql(sql);
		// 管线编号
		sql = "update ptem_filter t1 set t1.pipelineno="
				+ "(select t2.pipelineno from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.pipelineno is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update ptem_filter t1 set t1.pipelineno=" +
		// "(select t2.pipelineno from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 地图经纬度
		updatePointLBMap("ptem_filter", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);

	}

	// 更新表E-2安全阀
	public void updateSafetyValve() throws IOException {
		// 站箱名称
		String sql = "update ptem_safetyvalve t1 set t1.stationname="
				+ "(select t2.stationname from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.stationname is null";

		// String sql="update ptem_safetyvalve t1 set t1.stationname=" +
		// "(select t2.stationname from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 坐标y
		sql = "update ptem_safetyvalve t1 set t1.locationy="
				+ "(select t2.locationy from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.locationy is null";

		// sql="update ptem_safetyvalve t1 set t1.locationy=" +
		// "(select t2.locationy from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 坐标x
		// sql="update ptem_safetyvalve t1 set t1.locationx=" +
		// "(select t2.locationx from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno) where t1.locationx is null";
		sql = "update ptem_safetyvalve t1 set t1.locationx="
				+ "(select t2.locationx from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 高程h
		sql = "update ptem_safetyvalve t1 set t1.height="
				+ "(select t2.height from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.height is null";

		// sql="update ptem_safetyvalve t1 set t1.height=" +
		// "(select t2.height from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 经度L
		sql = "update ptem_safetyvalve t1 set t1.longitude="
				+ "(select t2.longitude from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.longitude is null";

		// sql="update ptem_safetyvalve t1 set t1.longitude=" +
		// "(select t2.longitude from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 纬度B
		sql = "update ptem_safetyvalve t1 set t1.latitude="
				+ "(select t2.latitude from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.latitude is null";

		// sql="update ptem_safetyvalve t1 set t1.latitude=" +
		// "(select t2.latitude from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 椭球高H
		sql = "update ptem_safetyvalve t1 set t1.ellipseh="
				+ "(select t2.ellipseh from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.ellipseh is null";

		// sql="update ptem_safetyvalve t1 set t1.ellipseh=" +
		// "(select t2.ellipseh from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 管线编号
		sql = "update ptem_safetyvalve t1 set t1.pipelineno="
				+ "(select t2.pipelineno from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.pipelineno is null";

		// sql="update ptem_safetyvalve t1 set t1.pipelineno=" +
		// "(select t2.pipelineno from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 经纬度
		// updatePointLB("ptem_safetyvalve","longitude","latitude","locationx","locationy");
		// 地图经纬度
		updatePointLBMap("ptem_safetyvalve", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	// 更新表E-2安全阀部分
	public void updateSafetyValve(String ids) throws IOException {
		// 站箱名称
		String sql = "update ptem_safetyvalve t1 set t1.stationname="
				+ "(select t2.stationname from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.stationname is null";
		sql+=" and t1.id in("+ids+")";
		// String sql="update ptem_safetyvalve t1 set t1.stationname=" +
		// "(select t2.stationname from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 坐标y
		sql = "update ptem_safetyvalve t1 set t1.locationy="
				+ "(select t2.locationy from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.locationy is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update ptem_safetyvalve t1 set t1.locationy=" +
		// "(select t2.locationy from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 坐标x
		 sql="update ptem_safetyvalve t1 set t1.locationx=" +
		 "(select t2.locationx from ptem_station t2 " +
		 "where t2.pipeno=t1.pipenetno) where t1.locationx is null";
		 sql+=" and t1.id in("+ids+")";
//		sql = "update ptem_safetyvalve t1 set t1.locationx="
//				+ "(select t2.locationx from ptem_station t2 "
//				+ "where t2.pipeno=t1.pipenetno)";
		
		dbService.exeSql(sql);
		// 高程h
		sql = "update ptem_safetyvalve t1 set t1.height="
				+ "(select t2.height from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.height is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update ptem_safetyvalve t1 set t1.height=" +
		// "(select t2.height from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 经度L
		sql = "update ptem_safetyvalve t1 set t1.longitude="
				+ "(select t2.longitude from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.longitude is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update ptem_safetyvalve t1 set t1.longitude=" +
		// "(select t2.longitude from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 纬度B
		sql = "update ptem_safetyvalve t1 set t1.latitude="
				+ "(select t2.latitude from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.latitude is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update ptem_safetyvalve t1 set t1.latitude=" +
		// "(select t2.latitude from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 椭球高H
		sql = "update ptem_safetyvalve t1 set t1.ellipseh="
				+ "(select t2.ellipseh from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.ellipseh is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update ptem_safetyvalve t1 set t1.ellipseh=" +
		// "(select t2.ellipseh from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 管线编号
		sql = "update ptem_safetyvalve t1 set t1.pipelineno="
				+ "(select t2.pipelineno from ptem_station t2 "
				+ "where t2.pipeno=t1.pipenetno) where t1.pipelineno is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update ptem_safetyvalve t1 set t1.pipelineno=" +
		// "(select t2.pipelineno from ptem_station t2 " +
		// "where t2.pipeno=t1.pipenetno)";
		dbService.exeSql(sql);
		// 经纬度
		// updatePointLB("ptem_safetyvalve","longitude","latitude","locationx","locationy");
		// 地图经纬度
		updatePointLBMap("ptem_safetyvalve", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}

	// 更新表F-1异常
	public void updateException() throws IOException {
		// 管网编号
		updatePipeSectionNo("ptem_exception", "pipesectionno", "locationx",
				"locationy");
		// 管线编号
		updatePipeLineNo("ptem_exception", "pipesectionno");
		// 异常编号
		updatePointNo("ptem_exception", "exceptionno", "YC");
		// 经纬度
		updatePointLB("ptem_exception", "longitude", "latitude", "locationx",
				"locationy");
		// 地图经纬度
		updatePointLBMap("ptem_exception", "longitude", "latitude",
				"longitude_map", "latitude_map");

	}
	// 更新表F-1异常部分
	public void updateException(String ids) throws IOException {
		// 管网编号
		updatePipeSectionNo("ptem_exception", "pipesectionno", "locationx",
				"locationy",ids);
		// 管线编号
		updatePipeLineNo("ptem_exception", "pipesectionno",ids);
		// 异常编号
		updatePointNo("ptem_exception", "exceptionno", "YC",ids);
		// 经纬度
		updatePointLB("ptem_exception", "longitude", "latitude", "locationx",
				"locationy",ids);
		// 地图经纬度
		updatePointLBMap("ptem_exception", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}

	// 更新表F-2特殊段
	public void updateSpecial() throws IOException {
		// 管线编号
		updatePipeLineNo("ptem_special", "pipesectionno");
		// 特殊段编号
		updatePointNo("ptem_special", "specialno", "TSD");
		// 经纬度
		updatePointLB("ptem_special", "BEGINNODEL", "BEGINNODEB", "BEGINNODEX",
				"BEGINNODEY");
		updatePointLB("ptem_special", "ENDNODEL", "ENDNODEB", "ENDNODEX",
				"ENDNODEY");
		// 地图经纬度
		updatePointLBMap("ptem_special", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEL_map", "BEGINNODEB_map");
		updatePointLBMap("ptem_special", "ENDNODEL", "ENDNODEB",
				"ENDNODEL_map", "ENDNODEB_map");
	}
	// 更新表F-2特殊段部分
	public void updateSpecial(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("ptem_special", "pipesectionno",ids);
		// 特殊段编号
		updatePointNo("ptem_special", "specialno", "TSD",ids);
		// 经纬度
		updatePointLB("ptem_special", "BEGINNODEL", "BEGINNODEB", "BEGINNODEX",
				"BEGINNODEY",ids);
		updatePointLB("ptem_special", "ENDNODEL", "ENDNODEB", "ENDNODEX",
				"ENDNODEY",ids);
		// 地图经纬度
		updatePointLBMap("ptem_special", "BEGINNODEL", "BEGINNODEB",
				"BEGINNODEL_map", "BEGINNODEB_map",ids);
		updatePointLBMap("ptem_special", "ENDNODEL", "ENDNODEB",
				"ENDNODEL_map", "ENDNODEB_map",ids);
	}
	// 表F -3 违章占压
	public void updateViolation() throws IOException {
		// 管网编号
		updatePipeSectionNo("ptem_violation", "pipesectionno", "locationx",
				"locationy");
		// 管线编号
		updatePipeLineNo("ptem_violation", "pipesectionno");
		// 经纬度
		updatePointLB("ptem_violation", "longitude", "latitude", "locationx",
				"locationy");
		updatePointLB("ptem_violation", "longitude2", "latitude2",
				"locationx2", "locationy2");
		updatePointLB("ptem_violation", "longitude3", "latitude3",
				"locationx3", "locationy3");
		updatePointLB("ptem_violation", "longitude4", "latitude4",
				"locationx4", "locationy4");

		// 地图经纬度
		updatePointLBMap("ptem_violation", "longitude", "latitude",
				"longitude_map", "latitude_map");
		updatePointLBMap("ptem_violation", "longitude2", "latitude2",
				"longitude_map2", "latitude_map2");
		updatePointLBMap("ptem_violation", "longitude3", "latitude3",
				"longitude_map3", "latitude_map3");
		updatePointLBMap("ptem_violation", "longitude4", "latitude4",
				"longitude_map4", "latitude_map4");

	}
	// 表F -3 违章占压部分
	public void updateViolation(String ids) throws IOException {
		// 管网编号
		updatePipeSectionNo("ptem_violation", "pipesectionno", "locationx",
				"locationy",ids);
		// 管线编号
		updatePipeLineNo("ptem_violation", "pipesectionno",ids);
		// 经纬度
		updatePointLB("ptem_violation", "longitude", "latitude", "locationx",
				"locationy",ids);
		updatePointLB("ptem_violation", "longitude2", "latitude2",
				"locationx2", "locationy2",ids);
		updatePointLB("ptem_violation", "longitude3", "latitude3",
				"locationx3", "locationy3",ids);
		updatePointLB("ptem_violation", "longitude4", "latitude4",
				"locationx4", "locationy4",ids);

		// 地图经纬度
		updatePointLBMap("ptem_violation", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
		updatePointLBMap("ptem_violation", "longitude2", "latitude2",
				"longitude_map2", "latitude_map2",ids);
		updatePointLBMap("ptem_violation", "longitude3", "latitude3",
				"longitude_map3", "latitude_map3",ids);
		updatePointLBMap("ptem_violation", "longitude4", "latitude4",
				"longitude_map4", "latitude_map4",ids);
	}

	// 更新表G 应急事件
	public void updateEmergency() throws IOException {
		// 管网编号
		updatePipeSectionNo("ptem_emergency_data", "pipeno", "locationx",
				"locationy");
		// 管线编号
		updatePipeLineNo("ptem_emergency_data", "pipeno");
		// 经纬度
		updatePointLB("ptem_emergency_data", "longitude", "latitude",
				"locationx", "locationy");
		// 地图经纬度
		updatePointLBMap("ptem_emergency_data", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	// 更新表G 应急事件部分
	public void updateEmergency(String ids) throws IOException {
		//转换主表ID为子表ID
		ids=changeIds(ids,"ptem_emergency_data");
		// 管网编号
		updatePipeSectionNo("ptem_emergency_data", "pipeno", "locationx",
				"locationy",ids);
		// 管线编号
		updatePipeLineNo("ptem_emergency_data", "pipeno",ids);
		// 经纬度
		updatePointLB("ptem_emergency_data", "longitude", "latitude",
				"locationx", "locationy",ids);
		// 地图经纬度
		updatePointLBMap("ptem_emergency_data", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}

	// 更新表G-1 泄漏点
	public void updateLeakpoint() throws IOException {
		// 管网编号
		updatePipeSectionNo("ptem_leakpoint", "pipeno", "locationx",
				"locationy");
		// 管线编号
		updatePipeLineNo("ptem_leakpoint", "pipeno");
		// 继承自表C的字段
		updateLeakpointFromC();
		// 经纬度
		updatePointLB("ptem_leakpoint", "longitude", "latitude", "locationx",
				"locationy");
		// 地图经纬度
		updatePointLBMap("ptem_leakpoint", "longitude", "latitude",
				"longitude_map", "latitude_map");

	}
	// 更新表G-1 泄漏点部分
	public void updateLeakpoint(String ids) throws IOException {
		// 管网编号
		updatePipeSectionNo("ptem_leakpoint", "pipeno", "locationx",
				"locationy",ids);
		// 管线编号
		updatePipeLineNo("ptem_leakpoint", "pipeno",ids);
		// 继承自表C的字段
		updateLeakpointFromC(ids);
		// 经纬度
		updatePointLB("ptem_leakpoint", "longitude", "latitude", "locationx",
				"locationy",ids);
		// 地图经纬度
		updatePointLBMap("ptem_leakpoint", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);

	}
	// 更新表H 生产作业
	public void updateOperations() throws IOException {
		// 管网编号
		updatePipeSectionNo("PTEM_OPERATIONS_DATA", "pipeno", "locationx",
				"locationy");
		// 管线编号
		updatePipeLineNo("PTEM_OPERATIONS_DATA", "pipeno");
		// 经纬度
		updatePointLB("PTEM_OPERATIONS_DATA", "longitude", "latitude",
				"locationx", "locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_OPERATIONS_DATA", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	public String changeIds(String ids,String tablename)throws IOException {
		String sql="select t.id from "+tablename+" t where t.parentid in("+
		ids+")";
		List<String> list=dbService.queryDataBySql(sql);
		int num=list.size();
		String childids="";
		for(int i=0;i<num;i++)
		{
			childids+=list.get(i);
			childids+=",";
		}
		if(childids.length()>0)
		{
			childids=childids.substring(0,childids.length()-1);
		}		
		return childids;
	}
	// 更新表H 生产作业部分
	public void updateOperations(String ids) throws IOException {
		//转换主表ID为子表ID
		ids=changeIds(ids,"PTEM_OPERATIONS_DATA");
		// 管网编号
		updatePipeSectionNo("PTEM_OPERATIONS_DATA", "pipeno", "locationx",
				"locationy",ids);
		// 管线编号
		updatePipeLineNo("PTEM_OPERATIONS_DATA", "pipeno",ids);
		// 经纬度
		updatePointLB("PTEM_OPERATIONS_DATA", "longitude", "latitude",
				"locationx", "locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_OPERATIONS_DATA", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}
	// 更新表H-1 带气作业机械预制件（Fitting）
	public void updateFilting() throws IOException {
		// 管网编号
		updatePipeSectionNo("ptem_fitting", "pipeno", "locationx", "locationy");
		// 管线编号
		updatePipeLineNo("ptem_fitting", "pipeno");
		// 经纬度
		updatePointLB("ptem_fitting", "longitude", "latitude", "locationx",
				"locationy");
		// 地图经纬度
		updatePointLBMap("ptem_fitting", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	// 更新表H-1 带气作业机械预制件（Fitting）部分
	public void updateFilting(String ids) throws IOException {
		
		// 管网编号
		updatePipeSectionNo("ptem_fitting", "pipeno", "locationx", "locationy",ids);
		// 管线编号
		updatePipeLineNo("ptem_fitting", "pipeno",ids);
		// 经纬度
		updatePointLB("ptem_fitting", "longitude", "latitude", "locationx",
				"locationy",ids);
		// 地图经纬度
		updatePointLBMap("ptem_fitting", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}

	// 更新表G-1 泄漏点中继承自表C的字段
	public void updateLeakpointFromC() throws IOException {
		// 管理单位
		String sql = "update ptem_leakpoint t1 set t1.MANAGEUNIT="
				+ "(select t2.MANAGEUNIT from ptem_pipesection t2 "
				+ "where t2.pipesectionno=t1.pipeno) where t1.MANAGEUNIT is null";

		// String sql="update ptem_leakpoint t1 set t1.MANAGEUNIT=" +
		// "(select t2.MANAGEUNIT from ptem_pipesection t2 " +
		// "where t2.pipesectionno=t1.pipeno)";
		dbService.exeSql(sql);
		// 管理部门
		sql = "update ptem_leakpoint t1 set t1.MANAGEDEPARTMENT="
				+ "(select t2.MANAGEDEPARTMENT from ptem_pipesection t2 "
				+ "where t2.pipesectionno=t1.pipeno) where t1.MANAGEDEPARTMENT is null";

		// sql="update ptem_leakpoint t1 set t1.MANAGEDEPARTMENT=" +
		// "(select t2.MANAGEDEPARTMENT from ptem_pipesection t2 " +
		// "where t2.pipesectionno=t1.pipeno)";
		dbService.exeSql(sql);
	}
	// 更新表G-1 泄漏点中继承自表C的字段部分
	public void updateLeakpointFromC(String ids) throws IOException {
		// 管理单位
		String sql = "update ptem_leakpoint t1 set t1.MANAGEUNIT="
				+ "(select t2.MANAGEUNIT from ptem_pipesection t2 "
				+ "where t2.pipesectionno=t1.pipeno) where t1.MANAGEUNIT is null";
		sql+=" and t1.id in("+ids+")";
		// String sql="update ptem_leakpoint t1 set t1.MANAGEUNIT=" +
		// "(select t2.MANAGEUNIT from ptem_pipesection t2 " +
		// "where t2.pipesectionno=t1.pipeno)";
		dbService.exeSql(sql);
		// 管理部门
		sql = "update ptem_leakpoint t1 set t1.MANAGEDEPARTMENT="
				+ "(select t2.MANAGEDEPARTMENT from ptem_pipesection t2 "
				+ "where t2.pipesectionno=t1.pipeno) where t1.MANAGEDEPARTMENT is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update ptem_leakpoint t1 set t1.MANAGEDEPARTMENT=" +
		// "(select t2.MANAGEDEPARTMENT from ptem_pipesection t2 " +
		// "where t2.pipesectionno=t1.pipeno)";
		dbService.exeSql(sql);
	}

	// 更新表2 检验汇总中多个值的字段
	public void updateTestSummaryMul(String pipelinenos, String id,
			String pipelinefield, String testsummaryfield) throws IOException {
		String sql = "";
		sql = "select distinct(" + pipelinefield + ") from ptem_pipeline t "
				+ "where t." + pipelinefield
				+ " is not null and t.pipelineno in (" + pipelinenos + ")";
		List<Object> diameterlist = dbService.queryDataBySql(sql);
		int diameternum = diameterlist.size();
		String strdiameters = "";
		if (diameternum == 0) {
			strdiameters = "/";
		} else {
			for (int j = 0; j < diameternum; j++) {
				strdiameters += diameterlist.get(j).toString();
				strdiameters += "；";
			}
			strdiameters = strdiameters.substring(0, strdiameters.length() - 1);
		}
		// 更新
		sql = "update ptem_test_summary t set t." + testsummaryfield + " ='";
		sql += strdiameters + "' where t.id='" + id + "'";
		sql += " and t." + testsummaryfield + " is null";
		dbService.exeSql(sql);
	}

	// 更新表2 检验汇总
	public void updateTestSummary() throws IOException {
		String sql = "";
		// 任务编号
		sql = "select t.id,t.taskno from ptem_test_summary t where t.taskno is not null";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			String taskno = obj[1].toString();
			// 根据任务编号获取管线编号
			sql = "select t.pipelineno,t.PIPESECTIONNO from ptem_test_task t where t.taskno='"
					+ taskno + "'";
			// sql+=" and t.pipelineno is not null";
			List<Object[]> listTask = dbService.queryDataBySql(sql);
			if(listTask.size()==0)
			{
				continue;
			}
			Object objT = listTask.get(0)[0];
			String pipelinenos = "";
			String pipesectionnos = "";
			if (objT != null) {
				pipelinenos = objT.toString();
			}
			objT = listTask.get(0)[1];
			if (objT != null) {
				pipesectionnos = objT.toString();
			}

			pipelinenos = pipelinenos.replace("；", ",");
			// 压力管道代码
			String pipecode = "";
			if (!pipelinenos.equals("")) {
				pipecode += pipelinenos;
			}
			if (!pipesectionnos.equals("")) {
				pipecode += "；";
				pipecode += pipesectionnos;
			}
			sql = "update ptem_test_summary t set t.PIPECODE ='" + pipecode
					+ "' where t.id='" + id + "'";
			dbService.exeSql(sql);
			// 通气日期
			sql = "update ptem_test_summary t set t.AERATEDATE ="
					+ "(select min(AERATEDATE) from ptem_pipeline t2 "
					+ "where t2.aeratedate is not null and t2.pipelineno in ("
					+ pipelinenos + ")) where t.id='" + id + "'";
			dbService.exeSql(sql);
			// 管道长度
			sql = "update ptem_test_summary t set t.PIPELENGTH ="
					+ "(select sum(length) from ptem_pipeline t2 "
					+ "where t2.length is not null and t2.pipelineno in ("
					+ pipelinenos + ")) where t.id='" + id + "'";
			dbService.exeSql(sql);
			// 管道规格（通径）
			updateTestSummaryMul(pipelinenos, id, "DIAMETER", "PIPESTANDARD");
			// 设计压力（MPa）
			updateTestSummaryMul(pipelinenos, id, "DESIGNPRESSURE",
					"DESIGNPRESSURE");
			// 设计温度(℃)
			updateTestSummaryMul(pipelinenos, id, "DESIGNTEMPERATURE",
					"DESIGNTEMPRATURE");
			// 设计介质
			updateTestSummaryMul(pipelinenos, id, "MEDIA", "DESIGNMEDIA");
			// 管道材质
			updateTestSummaryMul(pipelinenos, id, "MATERIAL", "PIPEMATERIAL");
		}
	}
	// 更新表2 检验汇总部分
	public void updateTestSummary(String ids) throws IOException {
		String sql = "";
		// 任务编号
		sql = "select t.id,t.taskno from ptem_test_summary t where t.taskno is not null";
		sql+=" and t.id in("+ids+")";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			String taskno = obj[1].toString();
			// 根据任务编号获取管线编号
			sql = "select t.pipelineno,t.PIPESECTIONNO from ptem_test_task t where t.taskno='"
					+ taskno + "'";
			// sql+=" and t.pipelineno is not null";
			List<Object[]> listTask = dbService.queryDataBySql(sql);
			Object objT = listTask.get(0)[0];
			String pipelinenos = "";
			String pipesectionnos = "";
			if (objT != null) {
				pipelinenos = objT.toString();
			}
			objT = listTask.get(0)[1];
			if (objT != null) {
				pipesectionnos = objT.toString();
			}

			pipelinenos = pipelinenos.replace("；", ",");
			// 压力管道代码
			String pipecode = "";
			if (!pipelinenos.equals("")) {
				pipecode += pipelinenos;
			}
			if (!pipesectionnos.equals("")) {
				pipecode += "；";
				pipecode += pipesectionnos;
			}
			sql = "update ptem_test_summary t set t.PIPECODE ='" + pipecode
					+ "' where t.id='" + id + "'";
			dbService.exeSql(sql);
			// 通气日期
			sql = "update ptem_test_summary t set t.AERATEDATE ="
					+ "(select min(AERATEDATE) from ptem_pipeline t2 "
					+ "where t2.aeratedate is not null and t2.pipelineno in ("
					+ pipelinenos + ")) where t.id='" + id + "'";
			dbService.exeSql(sql);
			// 管道长度
			sql = "update ptem_test_summary t set t.PIPELENGTH ="
					+ "(select sum(length) from ptem_pipeline t2 "
					+ "where t2.length is not null and t2.pipelineno in ("
					+ pipelinenos + ")) where t.id='" + id + "'";
			dbService.exeSql(sql);
			// 管道规格（通径）
			updateTestSummaryMul(pipelinenos, id, "DIAMETER", "PIPESTANDARD");
			// 设计压力（MPa）
			updateTestSummaryMul(pipelinenos, id, "DESIGNPRESSURE",
					"DESIGNPRESSURE");
			// 设计温度(℃)
			updateTestSummaryMul(pipelinenos, id, "DESIGNTEMPERATURE",
					"DESIGNTEMPRATURE");
			// 设计介质
			updateTestSummaryMul(pipelinenos, id, "MEDIA", "DESIGNMEDIA");
			// 管道材质
			updateTestSummaryMul(pipelinenos, id, "MATERIAL", "PIPEMATERIAL");
		}
	}

	// 更新表4宏观检查
	public void updateMacrotest() throws IOException {
		// 管道名称
		updatePipeName("ptem_macro_test");
	}
	// 更新表4宏观检查部分
	public void updateMacrotest(String ids) throws IOException {
		// 管道名称
		updatePipeName("ptem_macro_test",ids);
	}

	// 更新表4-1 特征点检测字段
	public void updatePointtestField(String tablename, String pointnofield,
			String pointno, String fielddes, String fieldsrc)
			throws IOException {
		String sql = "select t2." + fieldsrc + " from " + tablename
				+ " t2 where t2." + pointnofield + "='" + pointno + "'and t2."
				+ fieldsrc + " is not null";
		List<Object> list = dbService.queryDataBySql(sql);
		String value = "";
		if (list.size() != 0) {
			value = list.get(0).toString();
			if (value != null) {
				sql = "update PTEM_POINT_TEST t set t." + fielddes + "='"
						+ value + "'";
				sql += " where t." + fielddes + " is null";
				sql += " and t.pointno='" + pointno + "'";
				dbService.exeSql(sql);
			}
		}
		// System.out.println(value);
	}

	// 更新表4-1 特征点检测中类型字段
	public void updatePointtestFieldType(String tablename, String pointnofield,
			String pointno, String fielddes, String fieldsrc)
			throws IOException {
		String sql = "update PTEM_POINT_TEST t set t." + fielddes + "='"
				+ fieldsrc + "'";
		sql += " where t." + fielddes + " is null";
		sql += " and t.pointno='" + pointno + "'";
		dbService.exeSql(sql);
	}

	// 更新特征点检测表中类型为特征点的记录
	public void updatePointtestFieldTZD(String pointno) throws IOException {
		String tablename = "PTEM_PIPEPOINT";
		String pointnofield = "pointno";
		// 管线编号
		updatePointtestField(tablename, pointnofield, pointno, "pipelineno",
				"pipelineno");
		// 管网编号
		updatePointtestField(tablename, pointnofield, pointno, "pipeno",
				"PIPESECTIONNO");
		// 特征点名称
		updatePointtestField(tablename, pointnofield, pointno, "POINTNAME",
				"POINTNAME");
		// 类型
		updatePointtestField(tablename, pointnofield, pointno, "TYPE", "TYPE");
		// 坐标Y
		updatePointtestField(tablename, pointnofield, pointno, "LOCATIONY",
				"LOCATIONY");
		// 坐标X
		updatePointtestField(tablename, pointnofield, pointno, "LOCATIONX",
				"LOCATIONX");
		// 高程h
		updatePointtestField(tablename, pointnofield, pointno, "HEIGHT",
				"HEIGHT");
	}

	// 更新特征点检测表中类型为三通的记录
	public void updatePointtestFieldST(String pointno) throws IOException {
		String tablename = "PTEM_POINT_TEE";
		String pointnofield = "TEENO";
		// 管线编号
		updatePointtestField(tablename, pointnofield, pointno, "pipelineno",
				"pipelineno");
		// 管网编号
		updatePointtestField(tablename, pointnofield, pointno, "pipeno",
				"PIPESECTIONNO");
		// 特征点名称
		updatePointtestField(tablename, pointnofield, pointno, "POINTNAME",
				"POINTNAME");
		// 类型
		updatePointtestField(tablename, pointnofield, pointno, "TYPE", "TYPE");
		// 坐标Y
		updatePointtestField(tablename, pointnofield, pointno, "LOCATIONY",
				"LOCATIONY");
		// 坐标X
		updatePointtestField(tablename, pointnofield, pointno, "LOCATIONX",
				"LOCATIONX");
		// 高程h
		updatePointtestField(tablename, pointnofield, pointno, "HEIGHT",
				"HEIGHT");
	}

	// 更新特征点检测表中的记录
	public void updatePointtestFieldS(String pointno, String tablename,
			String pointnofield, String pipelineField, String pipesectionField,
			String pointnameField, String typeField, String locationyField,
			String locationxField, String heightField) throws IOException {
		// 管线编号
		updatePointtestField(tablename, pointnofield, pointno, "pipelineno",
				pipelineField);
		// 管网编号
		if (!pipesectionField.equals("")) {
			updatePointtestField(tablename, pointnofield, pointno, "pipeno",
					pipesectionField);
		}
		// 特征点名称
		if (!pointnameField.equals("")) {
			updatePointtestField(tablename, pointnofield, pointno, "POINTNAME",
					pointnameField);
		}
		// 类型
		if (tablename.equals("PTEM_PIPEPOINT")) {
			updatePointtestField(tablename, pointnofield, pointno, "TYPE",
					typeField);
		} else {
			updatePointtestFieldType(tablename, pointnofield, pointno, "TYPE",
					typeField);
		}
		// 坐标Y
		updatePointtestField(tablename, pointnofield, pointno, "LOCATIONY",
				locationyField);
		// 坐标X
		updatePointtestField(tablename, pointnofield, pointno, "LOCATIONX",
				locationxField);
		// 高程h
		updatePointtestField(tablename, pointnofield, pointno, "HEIGHT",
				heightField);
	}

	// 更新表4-1 特征点检测
	public void updatePointtest() throws IOException {
		String sql = "select t.id,t.pointno from PTEM_POINT_TEST t where t.pointno is not null";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			String pointno = obj[1].toString();
			// 特征点
			if (pointno.indexOf("TZD") != -1) {
				updatePointtestFieldS(pointno, "PTEM_PIPEPOINT", "pointno",
						"pipelineno", "PIPESECTIONNO", "POINTNAME", "TYPE",
						"LOCATIONY", "LOCATIONX", "HEIGHT");
			}
			// 三通
			else if (pointno.indexOf("ST") != -1) {
				updatePointtestFieldS(pointno, "PTEM_POINT_TEE", "TEENO",
						"pipelineno", "PIPESECTIONNO", "", "三通", "LOCATIONY",
						"LOCATIONX", "HEIGHT");
			}
			// 阳极
			else if (pointno.indexOf("YJ") != -1) {
				updatePointtestFieldS(pointno, "PTEM_POINT_ANODE", "ANODENO",
						"pipelineno", "PIPESECTIONNO", "", "阳极", "LOCATIONY",
						"LOCATIONX", "HEIGHT");
			}
			// 测试桩
			else if (pointno.indexOf("CSZ") != -1) {
				updatePointtestFieldS(pointno, "PTEM_POINT_POLE", "POLENO",
						"pipelineno", "PIPESECTIONNO", "", "测试桩", "LOCATIONY",
						"LOCATIONX", "HEIGHT");
			}
			// 排流装置
			else if (pointno.indexOf("PLZZ") != -1) {
				updatePointtestFieldS(pointno, "PTEM_POINT_DRAINAGE",
						"DRAINAGECODE", "pipelineno", "PIPESECTIONNO", "",
						"排流装置", "LOCATIONY", "LOCATIONX", "HEIGHT");
			}
			// 穿跨越
			else if (pointno.indexOf("CKY") != -1) {
				updatePointtestFieldS(pointno, "PTEM_POINT_CROSSING",
						"CROSSINGNO", "pipelineno", "PIPENO", "", "穿跨越",
						"BEGINNODEY", "BEGINNODEX", "BEGINNODEH");
			}
			// 套管
			else if (pointno.indexOf("TG") != -1) {
				updatePointtestFieldS(pointno, "PTEM_POINT_CASING", "CASINGNO",
						"pipelineno", "PIPENO", "", "套管", "BEGINNODEY",
						"BEGINNODEX", "BEGINNODEH");
			}
			// 弯管
			else if (pointno.indexOf("WG") != -1) {
				updatePointtestFieldS(pointno, "PTEM_POINT_BEND", "BENDNO",
						"pipelineno", "PIPESECTIONNO", "", "弯管", "BEGINNODEY",
						"BEGINNODEX", "BEGINNODEH");
			}
			// 内衬
			else if (pointno.indexOf("NC") != -1) {
				updatePointtestFieldS(pointno, "PTEM_POINT_LINER", "LINERNO",
						"pipelineno", "", "", "内衬", "BEGINNODEY", "BEGINNODEX",
						"BEGINNODEH");
			}
			// 阀门
			else if (pointno.indexOf("FM") != -1) {
				updatePointtestFieldS(pointno, "PTEM_VALVE", "VALVENO",
						"pipelineno", "PIPENO", "VALVENAME", "阀门", "LOCATIONY",
						"LOCATIONX", "HEIGHT");
			}
		}
		// 经纬度
		updatePointLB("PTEM_POINT_TEST", "longitude", "latitude", "locationx",
				"locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_POINT_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map");

	}
	// 更新表4-1 特征点检测部分
	public void updatePointtest(String ids) throws IOException {
		String sql = "select t.id,t.pointno from PTEM_POINT_TEST t where t.pointno is not null";
		sql+=" and t.id in("+ids+")";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			String pointno = obj[1].toString();
			// 特征点
			if (pointno.indexOf("TZD") != -1) {
				updatePointtestFieldS(pointno, "PTEM_PIPEPOINT", "pointno",
						"pipelineno", "PIPESECTIONNO", "POINTNAME", "TYPE",
						"LOCATIONY", "LOCATIONX", "HEIGHT");
			}
			// 三通
			else if (pointno.indexOf("ST") != -1) {
				updatePointtestFieldS(pointno, "PTEM_POINT_TEE", "TEENO",
						"pipelineno", "PIPESECTIONNO", "", "三通", "LOCATIONY",
						"LOCATIONX", "HEIGHT");
			}
			// 阳极
			else if (pointno.indexOf("YJ") != -1) {
				updatePointtestFieldS(pointno, "PTEM_POINT_ANODE", "ANODENO",
						"pipelineno", "PIPESECTIONNO", "", "阳极", "LOCATIONY",
						"LOCATIONX", "HEIGHT");
			}
			// 测试桩
			else if (pointno.indexOf("CSZ") != -1) {
				updatePointtestFieldS(pointno, "PTEM_POINT_POLE", "POLENO",
						"pipelineno", "PIPESECTIONNO", "", "测试桩", "LOCATIONY",
						"LOCATIONX", "HEIGHT");
			}
			// 排流装置
			else if (pointno.indexOf("PLZZ") != -1) {
				updatePointtestFieldS(pointno, "PTEM_POINT_DRAINAGE",
						"DRAINAGECODE", "pipelineno", "PIPESECTIONNO", "",
						"排流装置", "LOCATIONY", "LOCATIONX", "HEIGHT");
			}
			// 穿跨越
			else if (pointno.indexOf("CKY") != -1) {
				updatePointtestFieldS(pointno, "PTEM_POINT_CROSSING",
						"CROSSINGNO", "pipelineno", "PIPENO", "", "穿跨越",
						"BEGINNODEY", "BEGINNODEX", "BEGINNODEH");
			}
			// 套管
			else if (pointno.indexOf("TG") != -1) {
				updatePointtestFieldS(pointno, "PTEM_POINT_CASING", "CASINGNO",
						"pipelineno", "PIPENO", "", "套管", "BEGINNODEY",
						"BEGINNODEX", "BEGINNODEH");
			}
			// 弯管
			else if (pointno.indexOf("WG") != -1) {
				updatePointtestFieldS(pointno, "PTEM_POINT_BEND", "BENDNO",
						"pipelineno", "PIPESECTIONNO", "", "弯管", "BEGINNODEY",
						"BEGINNODEX", "BEGINNODEH");
			}
			// 内衬
			else if (pointno.indexOf("NC") != -1) {
				updatePointtestFieldS(pointno, "PTEM_POINT_LINER", "LINERNO",
						"pipelineno", "", "", "内衬", "BEGINNODEY", "BEGINNODEX",
						"BEGINNODEH");
			}
			// 阀门
			else if (pointno.indexOf("FM") != -1) {
				updatePointtestFieldS(pointno, "PTEM_VALVE", "VALVENO",
						"pipelineno", "PIPENO", "VALVENAME", "阀门", "LOCATIONY",
						"LOCATIONX", "HEIGHT");
			}
		}
		// 经纬度
		updatePointLB("PTEM_POINT_TEST", "longitude", "latitude", "locationx",
				"locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_POINT_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map");

	}
	// 更新表4-2穿跨越检测
	public void updateCrossingTest() throws IOException {
		// 管线编号
		String sql = "update PTEM_CROSSING_TEST t1 set t1.PIPELINENO="
				+ "(select t2.pipelineno from PTEM_POINT_CROSSING t2 "
				+ "where t2.CROSSINGNO=t1.CROSSINGNO) where t1.PIPELINENO is null";

		// String sql="update PTEM_CROSSING_TEST t1 set t1.PIPELINENO=" +
		// "(select t2.pipelineno from PTEM_POINT_CROSSING t2 " +
		// "where t2.CROSSINGNO=t1.CROSSINGNO)";

		dbService.exeSql(sql);
		// 穿跨越描述信息
		sql = "update PTEM_CROSSING_TEST t1 set t1.CROSSINGINFO="
				+ "(select t2.CROSSINGDESCRIPTION from PTEM_POINT_CROSSING t2 "
				+ "where t2.CROSSINGNO=t1.CROSSINGNO) where t1.CROSSINGINFO is null";

		// sql="update PTEM_CROSSING_TEST t1 set t1.CROSSINGINFO=" +
		// "(select t2.CROSSINGDESCRIPTION from PTEM_POINT_CROSSING t2 " +
		// "where t2.CROSSINGNO=t1.CROSSINGNO)";

		dbService.exeSql(sql);
		// 穿越类型
		sql = "update PTEM_CROSSING_TEST t1 set t1.CROSSINGTYPE="
				+ "(select t2.CROSSINGTYPE from PTEM_POINT_CROSSING t2 "
				+ "where t2.CROSSINGNO=t1.CROSSINGNO) where t1.CROSSINGTYPE is null";

		// sql="update PTEM_CROSSING_TEST t1 set t1.CROSSINGTYPE=" +
		// "(select t2.CROSSINGTYPE from PTEM_POINT_CROSSING t2 " +
		// "where t2.CROSSINGNO=t1.CROSSINGNO)";

		dbService.exeSql(sql);
		// 穿越对象类型
		sql = "update PTEM_CROSSING_TEST t1 set t1.OBJECTTYPE="
				+ "(select t2.OBJECTTYPE from PTEM_POINT_CROSSING t2 "
				+ "where t2.CROSSINGNO=t1.CROSSINGNO) where t1.OBJECTTYPE is null";

		// sql="update PTEM_CROSSING_TEST t1 set t1.OBJECTTYPE=" +
		// "(select t2.OBJECTTYPE from PTEM_POINT_CROSSING t2 " +
		// "where t2.CROSSINGNO=t1.CROSSINGNO)";

		dbService.exeSql(sql);
		// 穿越方式
		sql = "update PTEM_CROSSING_TEST t1 set t1.CROSSINGWAY="
				+ "(select t2.CROSSINGWAY from PTEM_POINT_CROSSING t2 "
				+ "where t2.CROSSINGNO=t1.CROSSINGNO) where t1.CROSSINGWAY is null";

		// sql="update PTEM_CROSSING_TEST t1 set t1.CROSSINGWAY=" +
		// "(select t2.CROSSINGWAY from PTEM_POINT_CROSSING t2 " +
		// "where t2.CROSSINGNO=t1.CROSSINGNO)";

		dbService.exeSql(sql);
		// 经纬度
		sql = "update PTEM_CROSSING_TEST t1 set t1.longitude="
				+ "(select t2.BEGINNODEL from PTEM_POINT_CROSSING t2 "
				+ "where t2.CROSSINGNO=t1.CROSSINGNO) where t1.longitude is null";

		// sql="update PTEM_CROSSING_TEST t1 set t1.longitude=" +
		// "(select t2.BEGINNODEL from PTEM_POINT_CROSSING t2 " +
		// "where t2.CROSSINGNO=t1.CROSSINGNO)";

		dbService.exeSql(sql);
		sql = "update PTEM_CROSSING_TEST t1 set t1.latitude="
				+ "(select t2.BEGINNODEB from PTEM_POINT_CROSSING t2 "
				+ "where t2.CROSSINGNO=t1.CROSSINGNO) where t1.latitude is null";

		// sql="update PTEM_CROSSING_TEST t1 set t1.latitude=" +
		// "(select t2.BEGINNODEB from PTEM_POINT_CROSSING t2 " +
		// "where t2.CROSSINGNO=t1.CROSSINGNO)";
		dbService.exeSql(sql);
		// updatePointLB("PTEM_CROSSING_TEST","longitude","latitude","locationx","locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_CROSSING_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map");

	}
	// 更新表4-2穿跨越检测部分
	public void updateCrossingTest(String ids) throws IOException {
		// 管线编号
		String sql = "update PTEM_CROSSING_TEST t1 set t1.PIPELINENO="
				+ "(select t2.pipelineno from PTEM_POINT_CROSSING t2 "
				+ "where t2.CROSSINGNO=t1.CROSSINGNO) where t1.PIPELINENO is null";
		sql+=" and t1.id in("+ids+")";
		// String sql="update PTEM_CROSSING_TEST t1 set t1.PIPELINENO=" +
		// "(select t2.pipelineno from PTEM_POINT_CROSSING t2 " +
		// "where t2.CROSSINGNO=t1.CROSSINGNO)";

		dbService.exeSql(sql);
		// 穿跨越描述信息
		sql = "update PTEM_CROSSING_TEST t1 set t1.CROSSINGINFO="
				+ "(select t2.CROSSINGDESCRIPTION from PTEM_POINT_CROSSING t2 "
				+ "where t2.CROSSINGNO=t1.CROSSINGNO) where t1.CROSSINGINFO is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update PTEM_CROSSING_TEST t1 set t1.CROSSINGINFO=" +
		// "(select t2.CROSSINGDESCRIPTION from PTEM_POINT_CROSSING t2 " +
		// "where t2.CROSSINGNO=t1.CROSSINGNO)";

		dbService.exeSql(sql);
		// 穿越类型
		sql = "update PTEM_CROSSING_TEST t1 set t1.CROSSINGTYPE="
				+ "(select t2.CROSSINGTYPE from PTEM_POINT_CROSSING t2 "
				+ "where t2.CROSSINGNO=t1.CROSSINGNO) where t1.CROSSINGTYPE is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update PTEM_CROSSING_TEST t1 set t1.CROSSINGTYPE=" +
		// "(select t2.CROSSINGTYPE from PTEM_POINT_CROSSING t2 " +
		// "where t2.CROSSINGNO=t1.CROSSINGNO)";

		dbService.exeSql(sql);
		// 穿越对象类型
		sql = "update PTEM_CROSSING_TEST t1 set t1.OBJECTTYPE="
				+ "(select t2.OBJECTTYPE from PTEM_POINT_CROSSING t2 "
				+ "where t2.CROSSINGNO=t1.CROSSINGNO) where t1.OBJECTTYPE is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update PTEM_CROSSING_TEST t1 set t1.OBJECTTYPE=" +
		// "(select t2.OBJECTTYPE from PTEM_POINT_CROSSING t2 " +
		// "where t2.CROSSINGNO=t1.CROSSINGNO)";

		dbService.exeSql(sql);
		// 穿越方式
		sql = "update PTEM_CROSSING_TEST t1 set t1.CROSSINGWAY="
				+ "(select t2.CROSSINGWAY from PTEM_POINT_CROSSING t2 "
				+ "where t2.CROSSINGNO=t1.CROSSINGNO) where t1.CROSSINGWAY is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update PTEM_CROSSING_TEST t1 set t1.CROSSINGWAY=" +
		// "(select t2.CROSSINGWAY from PTEM_POINT_CROSSING t2 " +
		// "where t2.CROSSINGNO=t1.CROSSINGNO)";

		dbService.exeSql(sql);
		// 经纬度
		sql = "update PTEM_CROSSING_TEST t1 set t1.longitude="
				+ "(select t2.BEGINNODEL from PTEM_POINT_CROSSING t2 "
				+ "where t2.CROSSINGNO=t1.CROSSINGNO) where t1.longitude is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update PTEM_CROSSING_TEST t1 set t1.longitude=" +
		// "(select t2.BEGINNODEL from PTEM_POINT_CROSSING t2 " +
		// "where t2.CROSSINGNO=t1.CROSSINGNO)";

		dbService.exeSql(sql);
		sql = "update PTEM_CROSSING_TEST t1 set t1.latitude="
				+ "(select t2.BEGINNODEB from PTEM_POINT_CROSSING t2 "
				+ "where t2.CROSSINGNO=t1.CROSSINGNO) where t1.latitude is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update PTEM_CROSSING_TEST t1 set t1.latitude=" +
		// "(select t2.BEGINNODEB from PTEM_POINT_CROSSING t2 " +
		// "where t2.CROSSINGNO=t1.CROSSINGNO)";
		dbService.exeSql(sql);
		// updatePointLB("PTEM_CROSSING_TEST","longitude","latitude","locationx","locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_CROSSING_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);

	}

	// 更新表4-3 泄漏检测
	public void updateLeakTest() throws IOException {
		// 管网编号
		updatePipeSectionNo("PTEM_LEAK_TEST", "pipeno", "locationx",
				"locationy");
		// 管线编号
		updatePipeLineNo("PTEM_LEAK_TEST", "pipeno");
		// 管道名称
		updatePipeName("PTEM_LEAK_TEST");
		// 经纬度
		updatePointLB("PTEM_LEAK_TEST", "longitude", "latitude", "locationx",
				"locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_LEAK_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	// 更新表4-3 泄漏检测部分
	public void updateLeakTest(String ids) throws IOException {
		// 管网编号
		updatePipeSectionNo("PTEM_LEAK_TEST", "pipeno", "locationx",
				"locationy",ids);
		// 管线编号
		updatePipeLineNo("PTEM_LEAK_TEST", "pipeno",ids);
		// 管道名称
		updatePipeName("PTEM_LEAK_TEST",ids);
		// 经纬度
		updatePointLB("PTEM_LEAK_TEST", "longitude", "latitude", "locationx",
				"locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_LEAK_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}
	// 更新管道名称
	public void updatePipeName(String tablename) throws IOException {
		// 管道名称
//		String sql = "update "
//				+ tablename
//				+ " t1 set t1.PIPENAME="
//				+ "(select t2.PIPENAME from ptem_test_task t2 where t2.taskno=t1.taskno)";
//		sql += " where t1.PIPENAME is null";
//		dbService.exeSql(sql);
		String sql="select t.id,t.taskno from "+tablename+" t";
		List<Object[]> list=dbService.queryDataBySql(sql);
		int num=list.size();
		for(int i=0;i<num;i++)
		{
			Object[] objs=list.get(i);
			String id=objs[0].toString();			 
			if(objs[1]!=null)
			{
				String taskno=objs[1].toString();
				String sqlT="select t2.PIPENAME from ptem_test_task t2 where t2.taskno='"+taskno+"'";
				List<String> listR=dbService.queryDataBySql(sqlT);
				if(listR.size()!=0)
				{
					String pipename=listR.get(0);
					sql="update "+tablename+" t set t.PIPENAME='"+pipename+"'";
					sql+=" where t.id='"+id+"'";
					dbService.exeSql(sql);
				}
			}
		}
	}
	// 更新管道名称部分
	public void updatePipeName(String tablename,String ids) throws IOException {
		// 管道名称
		String sql = "update "
				+ tablename
				+ " t1 set t1.PIPENAME="
				+ "(select t2.PIPENAME from ptem_test_task t2 where t2.taskno=t1.taskno)";
		sql += " where t1.PIPENAME is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
	}
	// 表5-1 土壤腐蚀性检测
	public void updateSoilcorrosion() throws IOException {
		// 管道名称
		updatePipeName("PTEM_SOILCORROSION");
		// 管网编号
		updatePipeSectionNo("PTEM_SOILCORROSION", "pipeno", "locationx",
				"locationy");
		// 管线编号
		updatePipeLineNo("PTEM_SOILCORROSION", "pipeno");
		// 土壤检测点编号
		updatePointNo("PTEM_SOILCORROSION", "TESTPOINTNO", "TRD");
		String sql = "";
		// 土壤电阻率(Ω·m)
		// String sql="update PTEM_SOILCORROSION t set
		// t.SOILRESISTIVITY=t.POLEDISTANCE*t.SHOWVALUE";
		// sql+=" where t.SOILRESISTIVITY is null";
		// dbService.exeSql(sql);
		// 土壤腐蚀性评价
		sql = "select t.id,t.SOILRESISTIVITY from PTEM_SOILCORROSION t where t.SOILRESISTIVITY is not null";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object obj[] = list.get(i);
			String id = obj[0].toString();
			Double soilresistivity = Double.parseDouble(obj[1].toString());
			//
			String level = "";
			if (soilresistivity < 20) {
				level = "强";
			} else if (soilresistivity <= 50 && soilresistivity >= 20) {
				level = "中";
			} else if (soilresistivity > 50) {
				level = "弱";
			}
			sql = "update PTEM_SOILCORROSION t set t.SOILCORROSIONEVALUATE='"
					+ level + "'";
			sql += "where t.id='" + id + "'";
			sql += " and t.SOILCORROSIONEVALUATE is null";
			dbService.exeSql(sql);
		}
		// 经纬度
		updatePointLB("PTEM_SOILCORROSION", "longitude", "latitude",
				"locationx", "locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_SOILCORROSION", "longitude", "latitude",
				"longitude_map", "latitude_map");

	}
	// 表5-1 土壤腐蚀性检测部分
	public void updateSoilcorrosion(String ids) throws IOException {
		// 管道名称
		updatePipeName("PTEM_SOILCORROSION",ids);
		// 管网编号
		updatePipeSectionNo("PTEM_SOILCORROSION", "pipeno", "locationx",
				"locationy",ids);
		// 管线编号
		updatePipeLineNo("PTEM_SOILCORROSION", "pipeno",ids);
		// 土壤检测点编号
		updatePointNo("PTEM_SOILCORROSION", "TESTPOINTNO", "TRD",ids);
		String sql = "";
		// 土壤电阻率(Ω·m)
		// String sql="update PTEM_SOILCORROSION t set
		// t.SOILRESISTIVITY=t.POLEDISTANCE*t.SHOWVALUE";
		// sql+=" where t.SOILRESISTIVITY is null";
		// dbService.exeSql(sql);
		// 土壤腐蚀性评价
		sql = "select t.id,t.SOILRESISTIVITY from PTEM_SOILCORROSION t where t.SOILRESISTIVITY is not null";
		sql+=" and t.id in("+ids+")";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object obj[] = list.get(i);
			String id = obj[0].toString();
			Double soilresistivity = Double.parseDouble(obj[1].toString());
			//
			String level = "";
			if (soilresistivity < 20) {
				level = "强";
			} else if (soilresistivity <= 50 && soilresistivity >= 20) {
				level = "中";
			} else if (soilresistivity > 50) {
				level = "弱";
			}
			sql = "update PTEM_SOILCORROSION t set t.SOILCORROSIONEVALUATE='"
					+ level + "'";
			sql += "where t.id='" + id + "'";
			sql += " and t.SOILCORROSIONEVALUATE is null";
			dbService.exeSql(sql);
		}
		// 经纬度
		updatePointLB("PTEM_SOILCORROSION", "longitude", "latitude",
				"locationx", "locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_SOILCORROSION", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);

	}
	// 表5-2 杂散电流检测数据
	public void updateStraycurrenttestdata() throws IOException {
		String sql="";
		//更新管线编号	
		sql="update PTEM_STRAYCURRENTTEST_DATA t set t.pipelineno =" +
				"(select t2.pipelineno from PTEM_STRAYCURRENTTEST t2 where t2.id=t.parentid)";
		dbService.exeSql(sql);
		//
		sql = "select t.id,t.RADIALGRADIENT,t.LONGITUDINALGRADIENT,t.ACDENSITY from "
				+ "PTEM_STRAYCURRENTTEST_DATA t where t.RADIALGRADIENT is not null "
				+ "and t.LONGITUDINALGRADIENT is not null and t.POTENTIALGRADIENT is null";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			Double radialgradient = Double.parseDouble(obj[1].toString()); // 直流电位梯度径向（mV/m）
			Double longitudinalgradient = Double.parseDouble(obj[2].toString()); // 直流电位梯度纵向（mV/m）
			String strAcdensity = "";// 交流电流密度(A/m2)
			if (obj[3] != null) {
				strAcdensity = obj[3].toString();
			}
			
			// 计算直流电位梯度（mV/m）
			Double potentialgradient = Math.sqrt(Math.pow(radialgradient, 2)
					+ Math.pow(longitudinalgradient, 2));
			String strpotentialgradient = potentialgradient.toString();
			// 直流电位梯度（mV/m）
			sql = "update PTEM_STRAYCURRENTTEST_DATA t set t.POTENTIALGRADIENT='"
					+ strpotentialgradient + "' where t.id='" + id + "'";
			sql += " and t.POTENTIALGRADIENT is null";
			dbService.exeSql(sql);
			// 直流干扰程度/*根据直流电位梯度判断，<0.5 弱; >=0.5且<5中; >=5 强*/
			String currentdisturblevel = "";
			if (potentialgradient < 0.5) {
				currentdisturblevel = "弱";
			} else if (potentialgradient < 5) {
				currentdisturblevel = "中";
			} else {
				currentdisturblevel = "强";
			}
			sql = "update PTEM_STRAYCURRENTTEST_DATA t set t.CURRENTDISTURBLEVEL ='"
					+ currentdisturblevel + "' where t.id='" + id + "'";
			sql += " and t.CURRENTDISTURBLEVEL is null";
			dbService.exeSql(sql);
			// 交流干扰程度 根据交流电流密度判断，<30 弱；>=30且<=100 中； >100 强
			String acditurblevel = "";
			if (!strAcdensity.equals("")) {				
				Double acdensity = Double.parseDouble(strAcdensity);
				if (acdensity < 30) {
					acditurblevel = "弱";
				} else if (acdensity <= 100) {
					acditurblevel = "中";
				} else {
					acditurblevel = "强";
				}
				sql = "update PTEM_STRAYCURRENTTEST_DATA t set t.ACDISTURBLEVEL ='"
						+ acditurblevel + "' where t.id='" + id + "'";
				sql += " and t.ACDISTURBLEVEL is null";
				dbService.exeSql(sql);
			}
			// 检测结果
			String result="";
			if(currentdisturblevel.equals("强")||acditurblevel.equals("强"))
			{
				result="强";
			}
			else if(currentdisturblevel.equals("中")||acditurblevel.equals("中"))
			{
				result="中";
			}
			else if(currentdisturblevel.equals("弱")||acditurblevel.equals("弱"))
			{
				result="弱";
			}
			sql = "update PTEM_STRAYCURRENTTEST_DATA t set t.TESTRESULT ='"
				+ result + "' where t.id='" + id + "'";
			sql += " and t.TESTRESULT is null";
			dbService.exeSql(sql);
		}
	}
	// 表5-2 杂散电流检测数据
	public void updateStraycurrenttestdata(String parentids) throws IOException {
		String sql="";
		//更新管线编号
		sql="update PTEM_STRAYCURRENTTEST_DATA t set t.pipelineno =" +
		"(select t2.pipelineno from PTEM_STRAYCURRENTTEST t2 where t2.id=t.parentid)";
		sql+=" where t.parentid in("+parentids+")";
		dbService.exeSql(sql);
		//
		sql = "select t.id,t.RADIALGRADIENT,t.LONGITUDINALGRADIENT,t.ACDENSITY from "
				+ "PTEM_STRAYCURRENTTEST_DATA t where t.RADIALGRADIENT is not null "
				+ "and t.LONGITUDINALGRADIENT is not null and t.POTENTIALGRADIENT is null";
		sql+=" and t.parentid in("+parentids+")";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			Object[] obj = list.get(i);
			String id = obj[0].toString();
			Double radialgradient = Double.parseDouble(obj[1].toString()); // 直流电位梯度径向（mV/m）
			Double longitudinalgradient = Double.parseDouble(obj[2].toString()); // 直流电位梯度纵向（mV/m）
			String strAcdensity = "";// 交流电流密度(A/m2)
			if (obj[3] != null) {
				strAcdensity = obj[3].toString();
			}
			
			// 计算直流电位梯度（mV/m）
			Double potentialgradient = Math.sqrt(Math.pow(radialgradient, 2)
					+ Math.pow(longitudinalgradient, 2));
			String strpotentialgradient = potentialgradient.toString();
			// 直流电位梯度（mV/m）
			sql = "update PTEM_STRAYCURRENTTEST_DATA t set t.POTENTIALGRADIENT='"
					+ strpotentialgradient + "' where t.id='" + id + "'";
			sql += " and t.POTENTIALGRADIENT is null";
			dbService.exeSql(sql);
			// 直流干扰程度/*根据直流电位梯度判断，<0.5 弱; >=0.5且<5中; >=5 强*/
			String currentdisturblevel = "";
			if (potentialgradient < 0.5) {
				currentdisturblevel = "弱";
			} else if (potentialgradient < 5) {
				currentdisturblevel = "中";
			} else {
				currentdisturblevel = "强";
			}
			sql = "update PTEM_STRAYCURRENTTEST_DATA t set t.CURRENTDISTURBLEVEL ='"
					+ currentdisturblevel + "' where t.id='" + id + "'";
			sql += " and t.CURRENTDISTURBLEVEL is null";
			dbService.exeSql(sql);
			// 交流干扰程度 根据交流电流密度判断，<30 弱；>=30且<=100 中； >100 强
			String acditurblevel = "";
			if (!strAcdensity.equals("")) {				
				Double acdensity = Double.parseDouble(strAcdensity);
				if (acdensity < 30) {
					acditurblevel = "弱";
				} else if (acdensity <= 100) {
					acditurblevel = "中";
				} else {
					acditurblevel = "强";
				}
				sql = "update PTEM_STRAYCURRENTTEST_DATA t set t.ACDISTURBLEVEL ='"
						+ acditurblevel + "' where t.id='" + id + "'";
				sql += " and t.ACDISTURBLEVEL is null";
				dbService.exeSql(sql);
			}
			// 检测结果
			String result="";
			if(currentdisturblevel.equals("强")||acditurblevel.equals("强"))
			{
				result="强";
			}
			else if(currentdisturblevel.equals("中")||acditurblevel.equals("中"))
			{
				result="中";
			}
			else if(currentdisturblevel.equals("弱")||acditurblevel.equals("弱"))
			{
				result="弱";
			}
			sql = "update PTEM_STRAYCURRENTTEST_DATA t set t.TESTRESULT ='"
				+ result + "' where t.id='" + id + "'";
			sql += " and t.TESTRESULT is null";
			dbService.exeSql(sql);
		}
	}

	// 表5-2 杂散电流检测
	public void updateStraycurrenttest() throws IOException {
		// 主表
		// 管网编号
		updatePipeSectionNo("PTEM_STRAYCURRENTTEST", "pipeno", "locationx",
				"locationy");
		// 管线编号
		updatePipeLineNo("PTEM_STRAYCURRENTTEST", "pipeno");
		// 杂散点编号
		updatePointNo("PTEM_STRAYCURRENTTEST", "STRAYPOINTNO", "ZSD");
		// 参比类型
		String sql = "update PTEM_STRAYCURRENTTEST t set t.REFERENCETYPE ='CSE'";
		sql += " where t.REFERENCETYPE is null";
		dbService.exeSql(sql);
		// 管道名称
		updatePipeName("PTEM_STRAYCURRENTTEST");
		// 防腐层类型
		sql = "update PTEM_STRAYCURRENTTEST t set t.COATINGTYPE ="
				+ "(select t2.COATINGTYPE from ptem_pipeline t2 "
				+ "where t2.pipelineno=t.pipelineno)";
		sql += " where t.COATINGTYPE is null";
		dbService.exeSql(sql);
		// 阴极保护方式
		sql = "update PTEM_STRAYCURRENTTEST t set t.CPWAY ="
				+ "(select t2.CPTYPE from ptem_pipeline t2 "
				+ "where t2.pipelineno=t.pipelineno)";
		sql += " where t.CPWAY is null";
		dbService.exeSql(sql);
		// 子表
		updateStraycurrenttestdata();
		// 经纬度
		updatePointLB("PTEM_STRAYCURRENTTEST", "longitude", "latitude",
				"locationx", "locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_STRAYCURRENTTEST", "longitude", "latitude",
				"longitude_map", "latitude_map");

	}
	// 表5-2 杂散电流检测部分
	public void updateStraycurrenttest(String ids) throws IOException {
		// 主表
		// 管网编号
		updatePipeSectionNo("PTEM_STRAYCURRENTTEST", "pipeno", "locationx",
				"locationy",ids);
		// 管线编号
		updatePipeLineNo("PTEM_STRAYCURRENTTEST", "pipeno",ids);
		// 杂散点编号
		updatePointNo("PTEM_STRAYCURRENTTEST", "STRAYPOINTNO", "ZSD",ids);
		// 参比类型
		String sql = "update PTEM_STRAYCURRENTTEST t set t.REFERENCETYPE ='CSE'";
		sql += " where t.REFERENCETYPE is null";
		sql+=" and t.id in("+ids+")";
		dbService.exeSql(sql);
		// 管道名称
		updatePipeName("PTEM_STRAYCURRENTTEST",ids);
		// 防腐层类型
		sql = "update PTEM_STRAYCURRENTTEST t set t.COATINGTYPE ="
				+ "(select t2.COATINGTYPE from ptem_pipeline t2 "
				+ "where t2.pipelineno=t.pipelineno)";
		sql += " where t.COATINGTYPE is null";
		sql+=" and t.id in("+ids+")";
		dbService.exeSql(sql);
		// 阴极保护方式
		sql = "update PTEM_STRAYCURRENTTEST t set t.CPWAY ="
				+ "(select t2.CPTYPE from ptem_pipeline t2 "
				+ "where t2.pipelineno=t.pipelineno)";
		sql += " where t.CPWAY is null";
		sql+=" and t.id in("+ids+")";
		dbService.exeSql(sql);
		// 子表
		updateStraycurrenttestdata(ids);
		// 经纬度
		updatePointLB("PTEM_STRAYCURRENTTEST", "longitude", "latitude",
				"locationx", "locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_STRAYCURRENTTEST", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}

	// 5-3评价结果
	/*
	 * 如果已填写则不自动计算。 根据防腐层类型和绝缘电阻值Rg判断。 先判断防腐层类型是否为环氧煤沥青或石油沥青或塑化沥青防蚀带。
	 * 环氧煤沥青或石油沥青或塑化沥青防蚀带： Rg>=10 1 Rg>=5且Rg<10 2 Rg>=2且Rg<5 3 Rg<2 4
	 * 其他防腐层类型： Rg>=100 1 Rg>=20且Rg<100 2 Rg>=5且Rg<20 3 Rg<5 4
	 */
	public String risoToResult(Double riso, int interval1, int interval2,
			int interval3) throws IOException {
		String result;
		if (riso >= interval1) {
			result = "1";
		} else if (riso >= interval2) {
			result = "2";
		} else if (riso >= interval3) {
			result = "3";
		} else {
			result = "4";
		}
		return result;
	}
	public String risoToResultRange(String prefix,Double riso, int interval1, int interval2,
			int interval3) throws IOException {
		String result="";
		if(prefix.equals("≥"))
		{
			if (riso >= interval1) {
				result = "1";
			} else if (riso >= interval2) {
				result = "2";
			} else if (riso >= interval3) {
				result = "3";
			} else {
				result = "4";
			}
		}
		else if(prefix.equals("≤"))
		{
			if (riso < interval3) {
				result = "4";
			} else if (riso < interval2) {
				result = "3";
			} else if (riso < interval1) {
				result = "2";
			} else {
				result = "1";
			}
		}	
		return result;
	}
	public String risoToResult(String prefix, Double riso, int interval1,
			int interval2, int interval3) throws IOException {
		String result;
		if (riso >= interval1) {
			result = "1";
		} else if (riso >= interval2) {
			result = "2";
		} else if (riso >= interval3) {
			result = "3";
		} else {
			result = "4";
		}
		return result;
	}

	public void updateRisotestpcmResult() throws IOException {
		String sql = "select t.ID,t.COATINGTYPE,t.RISOVALUE from "
				+ "PTEM_RISOTEST_PCM_TESTDATA t";
		List<Object[]> list = dbService.queryDataBySql(sql);
		int num = list.size();
		for (int i = 0; i < num; i++) {
			String id = "";
			String coatingtype = "";
			String risovalue = "";
			String prefix = "";
			Double riso = 0.0;
			Object obj1 = list.get(i)[0];
			id = obj1.toString();
			Object obj2 = list.get(i)[1];
			if (obj2 != null) {
				coatingtype = obj2.toString();
			}
			Object obj3 = list.get(i)[2];
			if (obj3 != null) {
				risovalue = obj3.toString();
				if (Character.isDigit(risovalue.charAt(0))) {
					riso = Double.parseDouble(risovalue);
				} else {
					prefix = risovalue.substring(0, 1);
					riso = Double.parseDouble(risovalue.substring(1, risovalue
							.length() - 1));
				}
			}
			String result = "";
			if (prefix.equals("")) {
				if (coatingtype.equals("环氧煤沥青") || coatingtype.equals("石油沥青")
						|| coatingtype.equals("塑化沥青防蚀带")) {
					result = risoToResult(riso, 10, 5, 2);
				} else {
					result = risoToResult(riso, 100, 20, 5);
				}
			}
			else
			{
				if (coatingtype.equals("环氧煤沥青") || coatingtype.equals("石油沥青")
						|| coatingtype.equals("塑化沥青防蚀带")) {
					result = risoToResultRange(prefix,riso, 10, 5, 2);
				} else {
					result = risoToResultRange(prefix,riso, 100, 20, 5);
				}
			}

			sql = "update PTEM_RISOTEST_PCM_TESTDATA t set t.EVALUATIONRESULT='";
			sql += result + "' where t.id='" + id + "'";
			sql += " and t.EVALUATIONRESULT is null";
			dbService.exeSql(sql);
		}
	}

	// 表5-3 防腐层绝缘电阻检测PCM
	public void updateRisotestpcm() throws IOException {
		//接入点经纬度
		updatePointLB("PTEM_RISOTEST_PCM", "ACCESSLONGITUDE", "ACCESSLATITUDE",
				"LOCATIONX", "LOCATIONY");
		// 坐标XY
		updatePointXY("PTEM_RISOTEST_PCM_TESTDATA", "longitude", "LATITUDE",
				"DATALOCATIONX", "DATALOCATIONY");
		// 管网编号
		updatePipeSectionNo("PTEM_RISOTEST_PCM_TESTDATA", "pipeno",
				"DATALOCATIONX", "DATALOCATIONY");
		// 管线编号
		updatePipeLineNo("PTEM_RISOTEST_PCM_TESTDATA", "pipeno");
		// 防腐层类型
		String sql = "update PTEM_RISOTEST_PCM_TESTDATA t set t.COATINGTYPE ="
				+ "(select t2.COATINGTYPE from ptem_pipeline t2 "
				+ "where t2.pipelineno=t.pipelineno)";
		sql += " where t.COATINGTYPE is null";
		dbService.exeSql(sql);
		// 评价结果
		updateRisotestpcmResult();
		// 阴极保护类型
		sql = "update PTEM_RISOTEST_PCM_TESTDATA t set t.CTTYPE ="
				+ "(select t2.CPTYPE from ptem_pipeline t2 "
				+ "where t2.pipelineno=t.pipelineno)";
		sql += " where t.CTTYPE is null";
		dbService.exeSql(sql);
		// 管道名称
		updatePipeName("PTEM_RISOTEST_PCM_TESTDATA");
		// 地图经纬度
		updatePointLBMap("PTEM_RISOTEST_PCM_TESTDATA", "longitude", "LATITUDE",
				"longitude_map", "latitude_map");
	}
	// 表5-3 防腐层绝缘电阻检测PCM部分
	public void updateRisotestpcm(String ids) throws IOException {
		//查询id		
		String childids=getchildids(ids,"PTEM_RISOTEST_PCM_TESTDATA");
		// 坐标XY
		updatePointXY("PTEM_RISOTEST_PCM_TESTDATA", "longitude", "LATITUDE",
				"DATALOCATIONX", "DATALOCATIONY",childids);
		// 管网编号
		updatePipeSectionNo("PTEM_RISOTEST_PCM_TESTDATA", "pipeno",
				"DATALOCATIONX", "DATALOCATIONY",childids);
		// 管线编号
		updatePipeLineNo("PTEM_RISOTEST_PCM_TESTDATA", "pipeno",childids);
		// 防腐层类型
		String sql = "update PTEM_RISOTEST_PCM_TESTDATA t set t.COATINGTYPE ="
				+ "(select t2.COATINGTYPE from ptem_pipeline t2 "
				+ "where t2.pipelineno=t.pipelineno)";
		sql += " where t.COATINGTYPE is null";
		sql+=" and t.parentid in("+ids+")";
		dbService.exeSql(sql);
		// 评价结果
		updateRisotestpcmResult();
		// 阴极保护类型
		sql = "update PTEM_RISOTEST_PCM_TESTDATA t set t.CTTYPE ="
				+ "(select t2.CPTYPE from ptem_pipeline t2 "
				+ "where t2.pipelineno=t.pipelineno)";
		sql += " where t.CTTYPE is null";
		sql+=" and t.parentid in("+ids+")";
		dbService.exeSql(sql);
		
		// 管道名称
		updatePipeName("PTEM_RISOTEST_PCM_TESTDATA",childids);
		// 地图经纬度
		updatePointLBMap("PTEM_RISOTEST_PCM_TESTDATA", "longitude", "LATITUDE",
				"longitude_map", "latitude_map",childids);
	}

	// 表5-4 防腐层绝缘电阻检测C扫描
	public void updateRisotestcscan() throws IOException {
		// 管道名称
		updatePipeName("PTEM_RISOTESTCSCAN");
		// 管网编号
		updatePipeSectionNo("PTEM_RISOTESTCSCAN", "pipeno", "locationx",
				"locationy");
		// 管线编号
		updatePipeLineNo("PTEM_RISOTESTCSCAN", "pipeno");
		// 经纬度
		updatePointLB("PTEM_RISOTESTCSCAN", "ACCESSLONGITUDE",
				"ACCESSLATITUDE", "locationx", "locationy");
	}
	// 表5-4 防腐层绝缘电阻检测C扫描部分
	public void updateRisotestcscan(String ids) throws IOException {
		// 管道名称
		updatePipeName("PTEM_RISOTESTCSCAN",ids);
		// 管网编号
		updatePipeSectionNo("PTEM_RISOTESTCSCAN", "pipeno", "locationx",
				"locationy",ids);
		// 管线编号
		updatePipeLineNo("PTEM_RISOTESTCSCAN", "pipeno",ids);
		// 经纬度
		updatePointLB("PTEM_RISOTESTCSCAN", "ACCESSLONGITUDE",
				"ACCESSLATITUDE", "locationx", "locationy",ids);
	}
	//电位差
	public void updatePotentialDifference() throws IOException {
		String sql="update PTEM_RISOTESTPEARSON_DATA t " +
				"set t.POTENTIALDIFFERENCE=t.STARTPOTENTIAL-t.POTENTIALAFTERDECAY";
		dbService.exeSql(sql);	
	}
	//表5-5 防腐层绝缘电阻检测PEARSON
	public void updateRisotestpearson() throws IOException {
		//电位差
		updatePotentialDifference();
		// 管道名称
		updatePipeName("PTEM_RISOTESTPEARSON");
		// 管网编号
		updatePipeSectionNo("PTEM_RISOTESTPEARSON", "pipeno", "ACCESSLOCATIONX",
				"ACCESSLOCATIONY");
		// 管线编号
		updatePipeLineNo("PTEM_RISOTESTPEARSON", "pipeno");
		// 数据经纬度
		updatePointLB("PTEM_RISOTESTPEARSON_DATA", "DATALONGITUDE",
				"DATALATITUDE", "locationx", "locationy");
		// 接入点经纬度
		updatePointLB("PTEM_RISOTESTPEARSON", "ACCESSLONGITUDE",
				"ACCESSLATITUDE", "ACCESSLOCATIONX", "ACCESSLOCATIONY");
	}
	public String getchildids(String ids,String tablename) throws IOException {
		String sql="select t.id from "+tablename+" t where t.parentid in("+ids+")";
		List<String> list=dbService.queryDataBySql(sql);
		int num=list.size();
		String childids="";
		for(int i=0;i<num;i++)
		{
			childids+=list.get(i);
			childids+=",";
		}
		childids=childids.substring(0,childids.length()-1);
		return childids;
	}
	//表5-5 防腐层绝缘电阻检测PEARSON
	public void updateRisotestpearson(String ids) throws IOException {
		//查询id
		String childids=getchildids(ids,"PTEM_RISOTEST_PCM_TESTDATA");
		//电位差
		updatePotentialDifference();
		// 管道名称
		updatePipeName("PTEM_RISOTESTPEARSON",ids);
		// 管网编号
		updatePipeSectionNo("PTEM_RISOTESTPEARSON", "pipeno", "ACCESSLOCATIONX",
				"ACCESSLOCATIONY",ids);
		// 管线编号
		updatePipeLineNo("PTEM_RISOTESTPEARSON", "pipeno",ids);
		// 数据经纬度
		updatePointLB("PTEM_RISOTESTPEARSON_DATA", "DATALONGITUDE",
				"DATALATITUDE", "locationx", "locationy",childids);
		// 接入点经纬度
		updatePointLB("PTEM_RISOTESTPEARSON", "ACCESSLONGITUDE",
				"ACCESSLATITUDE", "ACCESSLOCATIONX", "ACCESSLOCATIONY",childids);
	}
	// 表5-6 防腐层破损点
	public void updateCoatingDamagedpoint() throws IOException {
		// 管网编号
		updatePipeSectionNo("PTEM_COATING_DAMAGEDPOINT", "pipeno", "locationx",
				"locationy");
		// 管线编号
		updatePipeLineNo("PTEM_COATING_DAMAGEDPOINT", "pipeno");
		// 破损点编号
		updatePointNo("PTEM_COATING_DAMAGEDPOINT", "DAMAGEPOINTNO", "PSD");
		// 经纬度
		updatePointLB("PTEM_COATING_DAMAGEDPOINT", "longitude", "latitude",
				"locationx", "locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_COATING_DAMAGEDPOINT", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	// 表5-6 防腐层破损点
	public void updateCoatingDamagedpoint(String ids) throws IOException {
		// 管网编号
		updatePipeSectionNo("PTEM_COATING_DAMAGEDPOINT", "pipeno", "locationx",
				"locationy",ids);
		// 管线编号
		updatePipeLineNo("PTEM_COATING_DAMAGEDPOINT", "pipeno",ids);
		// 破损点编号
		updatePointNo("PTEM_COATING_DAMAGEDPOINT", "DAMAGEPOINTNO", "PSD",ids);
		// 经纬度
		updatePointLB("PTEM_COATING_DAMAGEDPOINT", "longitude", "latitude",
				"locationx", "locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_COATING_DAMAGEDPOINT", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}
	//表5-7 防腐层绝缘电阻评估
	public void updateCoatingRisoEvaluate() throws IOException {
		//管网编号 自动填写表C中管线编号所含管网编号，若已填写，则不自动更新。"
		String sql="select t.id,t.PIPELINENO from PTEM_COATING_RISO_EVALUATE t " +
				"where t.PIPELINENO is not null";
		List<Object[]> list=dbService.queryDataBySql(sql);
		int num=list.size();
		for(int i=0;i<num;i++)
		{
			Object[] obj=list.get(i);
			String id=obj[0].toString();
			String pipelineno=obj[1].toString();
			sql="select t.pipesectionno from ptem_pipesection t where t.pipelineno='";
			sql+=pipelineno+"' and t.pipesectionno is not null";
			List<String> listsec=dbService.queryDataBySql(sql);
			int secnum=listsec.size();
			String pipenos="";
			for(int j=0;j<secnum;j++)
			{
				String pipesectionno=listsec.get(j).toString();
				pipenos+=pipesectionno;
				pipenos+="；";
			}
			if(pipenos.length()!=0)
			{
				pipenos=pipenos.substring(0,pipenos.length()-1);
			}
			sql="update PTEM_COATING_RISO_EVALUATE t set t.PIPENO='"+pipenos+"'";
			sql+=" where t.id='"+id+"' and t.pipeno is null";
			dbService.exeSql(sql);		
		}
		//长度 调用B表/根据管网编号取表C“实际长度”，求和
		sql="update PTEM_COATING_RISO_EVALUATE t set t.LENGTH=" +
				"(select t2.LENGTH from PTEM_PIPELINE t2 where " +
				"t2.pipelineno=t.pipelineno) where t.length is null";
		dbService.exeSql(sql);
	}
	//表5-7 防腐层绝缘电阻评估部分
	public void updateCoatingRisoEvaluate(String ids) throws IOException {
		//管网编号 自动填写表C中管线编号所含管网编号，若已填写，则不自动更新。"
		String sql="select t.id,t.PIPELINENO from PTEM_COATING_RISO_EVALUATE t " +
				"where t.PIPELINENO is not null";
		sql+=" and t.id in("+ids+")";
		List<Object[]> list=dbService.queryDataBySql(sql);
		int num=list.size();
		for(int i=0;i<num;i++)
		{
			Object[] obj=list.get(i);
			String id=obj[0].toString();
			String pipelineno=obj[1].toString();
			sql="select t.pipesectionno from ptem_pipesection t where t.pipelineno='";
			sql+=pipelineno+"' and t.pipesectionno is not null";
			List<String> listsec=dbService.queryDataBySql(sql);
			int secnum=listsec.size();
			String pipenos="";
			for(int j=0;j<secnum;j++)
			{
				String pipesectionno=listsec.get(j).toString();
				pipenos+=pipesectionno;
				pipenos+="；";
			}
			if(pipenos.length()!=0)
			{
				pipenos=pipenos.substring(0,pipenos.length()-1);
			}
			sql="update PTEM_COATING_RISO_EVALUATE t set t.PIPENO='"+pipenos+"'";
			sql+=" where t.id='"+id+"' and t.pipeno is null";
			dbService.exeSql(sql);		
		}
		//长度 调用B表/根据管网编号取表C“实际长度”，求和
		sql="update PTEM_COATING_RISO_EVALUATE t set t.LENGTH=" +
				"(select t2.LENGTH from PTEM_PIPELINE t2 where " +
				"t2.pipelineno=t.pipelineno) where t.length is null";
		sql+=" and t.id in("+ids+")";
		dbService.exeSql(sql);
	}
	// 表5-8 测试桩检测字段
	public void updateTestPileinspectField(String fieldsrc,String fielddes) throws IOException {
		String sql="update PTEM_TESTPILEINSPECT t set t."+fielddes+" = " +
		"(select t2."+fieldsrc+" from PTEM_POINT_POLE t2 " +
		"where t2.POLENO=t.TESTPILENO) where t."+fielddes+" is null";
		dbService.exeSql(sql);
	}
	// 表5-8 测试桩检测字段部分
	public void updateTestPileinspectField(String fieldsrc,String fielddes,String ids) throws IOException {
		String sql="update PTEM_TESTPILEINSPECT set t."+fielddes+" = " +
		"(select t2."+fieldsrc+" from PTEM_POINT_POLE t2 " +
		"where t2.POLENO=t.TESTPILENO) where t."+fielddes+" is null";
		sql+=" and t.id in("+ids+")";
		dbService.exeSql(sql);
	}
	//表5-8 测试桩检测评定等级字段
	public void updateTestPileinspectLevel() throws IOException {
		String sql="select t.id,t.PROTECTPOTENTIAL from PTEM_TESTPILEINSPECT t" +
		" where t.PROTECTPOTENTIAL is not null";
		List<Object[]> list=dbService.queryDataBySql(sql);
		int num=list.size();
		for(int i=0;i<num;i++)
		{
			Object obj[] = list.get(i);
			String id = obj[0].toString();
			String projectPotential=obj[1].toString();
			Double projectPotentialval=Double.parseDouble(projectPotential);
			String level="";
			if(projectPotentialval<850)
			{
				level="欠保护<850";
			}
			else if(projectPotentialval<=1200)
			{
				level="保护850~1200";
			}
			else 
			{
				level="过保护>1200";
			}
			sql="update PTEM_TESTPILEINSPECT t set t.EVALUATELEVEL='"+level+
			"' where t.id='"+id+"'";
			sql+=" and t.EVALUATELEVEL is null";
			dbService.exeSql(sql);
		}
	}
	//表5-8 测试桩检测评定等级字段部分
	public void updateTestPileinspectLevel(String ids) throws IOException {
		String sql="select t.id,t.PROTECTPOTENTIAL from PTEM_TESTPILEINSPECT t" +
		" where t.PROTECTPOTENTIAL is not null";
		sql+=" and t.id in("+ids+")";
		List<Object[]> list=dbService.queryDataBySql(sql);
		int num=list.size();
		for(int i=0;i<num;i++)
		{
			Object obj[] = list.get(i);
			String id = obj[0].toString();
			String projectPotential=obj[1].toString();
			Double projectPotentialval=Double.parseDouble(projectPotential);
			String level="";
			if(projectPotentialval<850)
			{
				level="欠保护<850";
			}
			else if(projectPotentialval<=1200)
			{
				level="保护850~1200";
			}
			else 
			{
				level="过保护>1200";
			}
			sql="update PTEM_TESTPILEINSPECT t set t.EVALUATELEVEL='"+level+
			"' where t.id='"+id+"'";
			sql+=" and t.EVALUATELEVEL is null";
			dbService.exeSql(sql);
		}
	}
	// 表5-8 测试桩检测
	public void updateTestPileinspect() throws IOException {
		//地点描述
		updateTestPileinspectField("LOCATIONDESCRIPTION","LOCATIONDESCRIPTION");
		//坐标Y
		updateTestPileinspectField("LOCATIONY","LOCATIONY");
		//坐标X
		updateTestPileinspectField("LOCATIONX","LOCATIONX");
		//评定等级
		updateTestPileinspectLevel();
		//管道名称		
		updatePipeName("PTEM_TESTPILEINSPECT");
		//管线编号
		updateTestPileinspectField("PIPELINENO","PIPELINENO");
		//管网编号
		updateTestPileinspectField("PIPESECTIONNO","PIPENO");
		//经纬度
		updatePointLB("PTEM_TESTPILEINSPECT", "longitude", "latitude",
				"locationx", "locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_TESTPILEINSPECT", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	// 表5-8 测试桩检测部分
	public void updateTestPileinspect(String ids) throws IOException {
		//地点描述
		updateTestPileinspectField("LOCATIONDESCRIPTION","LOCATIONDESCRIPTION",ids);
		//坐标Y
		updateTestPileinspectField("LOCATIONY","LOCATIONY",ids);
		//坐标X
		updateTestPileinspectField("LOCATIONX","LOCATIONX",ids);
		//评定等级
		updateTestPileinspectLevel(ids);
		//管道名称		
		updatePipeName("PTEM_TESTPILEINSPECT",ids);
		//管线编号
		updateTestPileinspectField("PIPELINENO","PIPELINENO",ids);
		//管网编号
		updateTestPileinspectField("PIPESECTIONNO","PIPENO",ids);
		//经纬度
		updatePointLB("PTEM_TESTPILEINSPECT", "longitude", "latitude",
				"locationx", "locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_TESTPILEINSPECT", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}
	// 表5-9 阴极保护CIPS检测中的检测结果
	public void updateCIPSTestResult() throws IOException {
		String sql="select t.id,t.CIPS_ON from PTEM_CIPS_TEST_DATA t" +
		" where t.CIPS_ON is not null";
		sql+=" and t.TESTRESULT is null";
		List<Object[]> list=dbService.queryDataBySql(sql);
		int num=list.size();
		for(int i=0;i<num;i++)
		{
			Object obj[] = list.get(i);
			String id = obj[0].toString();
			String cips_on=obj[1].toString();
			Double cips_on_val=Double.parseDouble(cips_on);
			String level="";
			if(cips_on_val<850)
			{
				level="欠保护";
			}
			else if(cips_on_val<=1200)
			{
				level="保护";
			}
			else 
			{
				level="过保护";
			}
			sql="update PTEM_CIPS_TEST_DATA t set t.TESTRESULT='"+level+
			"' where t.id='"+id+"'";
			sql+=" and t.TESTRESULT is null";
			dbService.exeSql(sql);
		}
	}
	// 表5-9 阴极保护CIPS检测中的检测结果部分
	public void updateCIPSTestResult(String ids) throws IOException {
		String sql="select t.id,t.CIPS_ON from PTEM_CIPS_TEST_DATA t" +
		" where t.CIPS_ON is not null";
		sql+=" and t.id in("+ids+")";
		List<Object[]> list=dbService.queryDataBySql(sql);
		int num=list.size();
		for(int i=0;i<num;i++)
		{
			Object obj[] = list.get(i);
			String id = obj[0].toString();
			String cips_on=obj[1].toString();
			Double cips_on_val=Double.parseDouble(cips_on);
			String level="";
			if(cips_on_val<850)
			{
				level="欠保护";
			}
			else if(cips_on_val<=1200)
			{
				level="保护";
			}
			else 
			{
				level="过保护";
			}
			sql="update PTEM_CIPS_TEST_DATA t set t.TESTRESULT='"+level+
			"' where t.id='"+id+"'";
			sql+=" and t.TESTRESULT is null";
			dbService.exeSql(sql);
		}
	}
	// 表5-9 阴极保护CIPS检测
	public void updateCIPSTest() throws IOException {
		// 参比类型
		String sql = "update PTEM_CIPS_TEST t set t.REFERENCETYPE ='CSE'";
		sql += " where t.REFERENCETYPE is null";
		dbService.exeSql(sql);		
		// 数据图
		// 检测结果
		updateCIPSTestResult();
		// 接入点经度L、接入点纬度B
		updatePointLB("PTEM_CIPS_TEST", "ACCESSLONGITUDE", "ACCESSLATITUDE", "LOCATIONX",
				"LOCATIONY");
		// 转换经纬度
		convertLongitudeLatitude();
		// 数据坐标XY
		updatePointXY("PTEM_CIPS_TEST_DATA", "longitude", "LATUTIDE", "DATAX",
				"DATAY");
		// 管网编号
		updatePipeSectionNo("PTEM_CIPS_TEST_DATA", "pipeno", "DATAX", "DATAY");
		// 管线编号
		updatePipeLineNo("PTEM_CIPS_TEST_DATA", "pipeno");
		// 地图经纬度
		updatePointLBMap("PTEM_CIPS_TEST_DATA", "longitude", "LATUTIDE",
				"longitude_map", "latitude_map");
	}
	// 表5-9 阴极保护CIPS检测部分
	public void updateCIPSTest(String ids) throws IOException {
		//获取子表id
		String childid=getchildids(ids,"PTEM_CIPS_TEST_DATA");
		// 参比类型
		String sql = "update PTEM_CIPS_TEST t set t.REFERENCETYPE ='CSE'";
		sql += " where t.REFERENCETYPE is null";
		sql+=" and t.id in("+ids+")";
		dbService.exeSql(sql);		
		// 数据图
		// 检测结果
		updateCIPSTestResult(childid);
		// 接入点经度L、接入点纬度B
		updatePointLB("PTEM_CIPS_TEST", "ACCESSLONGITUDE", "ACCESSLATITUDE", "LOCATIONX",
				"LOCATIONY",ids);
		// 转换经纬度
		convertLongitudeLatitude(childid);
		// 数据坐标XY
		updatePointXY("PTEM_CIPS_TEST_DATA", "longitude", "LATUTIDE", "DATAX",
				"DATAY",childid);
		// 管网编号
		updatePipeSectionNo("PTEM_CIPS_TEST_DATA", "pipeno", "DATAX", "DATAY",childid);
		// 管线编号
		updatePipeLineNo("PTEM_CIPS_TEST_DATA", "pipeno",childid);
		// 地图经纬度
		updatePointLBMap("PTEM_CIPS_TEST_DATA", "longitude", "LATUTIDE",
				"longitude_map", "latitude_map",childid);
	}
	//从管段表中获取管段编号来更新管网编号
	public void updatePipenoFromSec(String tablename)throws IOException {
		String sql="select t.id,t.PIPELINENO from " +tablename+
		"  t where t.PIPELINENO is not null";
		List<Object[]> list=dbService.queryDataBySql(sql);
		int num=list.size();
		for(int i=0;i<num;i++)
		{
			Object[] obj=list.get(i);
			String id=obj[0].toString();
			String pipelineno=obj[1].toString();
			sql="select t.pipesectionno from ptem_pipesection t where t.pipelineno='";
			sql+=pipelineno+"' and t.pipesectionno is not null";
			List<String> listsec=dbService.queryDataBySql(sql);
			int secnum=listsec.size();
			String pipenos="";
			for(int j=0;j<secnum;j++)
			{
				String pipesectionno=listsec.get(j).toString();
				pipenos+=pipesectionno;
				pipenos+="；";
			}
			if(pipenos.length()!=0)
			{
				pipenos=pipenos.substring(0,pipenos.length()-1);
			}
			sql="update "+tablename+" t set t.PIPENO='"+pipenos+"'";
			sql+=" where t.id='"+id+"' and t.pipeno is null";
			dbService.exeSql(sql);		
		}
	}
	//从管段表中获取管段编号来更新管网编号部分
	public void updatePipenoFromSec(String tablename,String ids)throws IOException {
		String sql="select t.id,t.PIPELINENO from " +tablename+
		"  t where t.PIPELINENO is not null";
		sql+=" and t.id in("+ids+")";
		List<Object[]> list=dbService.queryDataBySql(sql);
		int num=list.size();
		for(int i=0;i<num;i++)
		{
			Object[] obj=list.get(i);
			String id=obj[0].toString();
			String pipelineno=obj[1].toString();
			sql="select t.pipesectionno from ptem_pipesection t where t.pipelineno='";
			sql+=pipelineno+"' and t.pipesectionno is not null";
			List<String> listsec=dbService.queryDataBySql(sql);
			int secnum=listsec.size();
			String pipenos="";
			for(int j=0;j<secnum;j++)
			{
				String pipesectionno=listsec.get(j).toString();
				pipenos+=pipesectionno;
				pipenos+="；";
			}
			if(pipenos.length()!=0)
			{
				pipenos=pipenos.substring(0,pipenos.length()-1);
			}
			sql="update "+tablename+" t set t.PIPENO='"+pipenos+"'";
			sql+=" where t.id='"+id+"' and t.pipeno is null";
			dbService.exeSql(sql);		
		}
	}
	//表5-10 阴极保护效果评估
	public void updateCPEvaluate() throws IOException {
		//管网编号 自动填写表C中管线编号所含管网编号，若已填写，则不自动更新。"
		updatePipenoFromSec("PTEM_CP_EVALUATE");
		//长度 调用B表/根据管网编号取表C“实际长度”，求和
		String sql="update PTEM_CP_EVALUATE t set t.LENGTH=" +
				"(select t2.LENGTH from PTEM_PIPELINE t2 where " +
				"t2.pipelineno=t.pipelineno) where t.length is null";
		dbService.exeSql(sql);
	}
	//表5-10 阴极保护效果评估部分
	public void updateCPEvaluate(String ids) throws IOException {
		//管网编号 自动填写表C中管线编号所含管网编号，若已填写，则不自动更新。"
		updatePipenoFromSec("PTEM_CP_EVALUATE",ids);
		//长度 调用B表/根据管网编号取表C“实际长度”，求和
		String sql="update PTEM_CP_EVALUATE t set t.LENGTH=" +
				"(select t2.LENGTH from PTEM_PIPELINE t2 where " +
				"t2.pipelineno=t.pipelineno) where t.length is null";
		sql+=" and t.id in("+ids+")";
		dbService.exeSql(sql);
	}
	
	//表5-11 排流装置检测
	public void updateCurrentdisturbtest() throws IOException {
		//管网编号
		String sql="update PTEM_CURRENTDISTURB_TEST t set t.PIPENO=" +
				"(select t2.PIPESECTIONNO from PTEM_POINT_DRAINAGE t2 " +
				"where t2.DRAINAGECODE=t.EQUIPMENTCODE)";
		sql+=" where t.PIPENO is null";
		dbService.exeSql(sql);
		//坐标Y
		sql="update PTEM_CURRENTDISTURB_TEST t set t.LOCATIONY=" +
		"(select t2.LOCATIONY from PTEM_POINT_DRAINAGE t2 " +
		"where t2.DRAINAGECODE=t.EQUIPMENTCODE)";
		sql+=" where t.LOCATIONY is null";
		dbService.exeSql(sql);
		//坐标X
		sql="update PTEM_CURRENTDISTURB_TEST t set t.LOCATIONX=" +
		"(select t2.LOCATIONX from PTEM_POINT_DRAINAGE t2 " +
		"where t2.DRAINAGECODE=t.EQUIPMENTCODE)";
		sql+=" where t.LOCATIONX is null";
		dbService.exeSql(sql);
		//经纬度
		updatePointLB("PTEM_CURRENTDISTURB_TEST", "longitude", "latitude",
				"locationx", "locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_CURRENTDISTURB_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	
	//表5-11 排流装置检测部分
	public void updateCurrentdisturbtest(String ids) throws IOException {
		//管网编号
		String sql="update PTEM_CURRENTDISTURB_TEST t set t.PIPENO=" +
				"(select t2.PIPESECTIONNO from PTEM_POINT_DRAINAGE t2 " +
				"where t2.DRAINAGECODE=t.EQUIPMENTCODE)";
		sql+=" where t.PIPENO is null";
		sql+=" and t.id in("+ids+")";
		dbService.exeSql(sql);
		//坐标Y
		sql="update PTEM_CURRENTDISTURB_TEST t set t.LOCATIONY=" +
		"(select t2.LOCATIONY from PTEM_POINT_DRAINAGE t2 " +
		"where t2.DRAINAGECODE=t.EQUIPMENTCODE)";
		sql+=" where t.LOCATIONY is null";
		sql+=" and t.id in("+ids+")";
		dbService.exeSql(sql);
		//坐标X
		sql="update PTEM_CURRENTDISTURB_TEST t set t.LOCATIONX=" +
		"(select t2.LOCATIONX from PTEM_POINT_DRAINAGE t2 " +
		"where t2.DRAINAGECODE=t.EQUIPMENTCODE)";
		sql+=" where t.LOCATIONX is null";
		sql+=" and t.id in("+ids+")";
		dbService.exeSql(sql);
		//经纬度
		updatePointLB("PTEM_CURRENTDISTURB_TEST", "longitude", "latitude",
				"locationx", "locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_CURRENTDISTURB_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}
	//表5-11-2 交流干扰防护系统检测
	public void updateAcdisturbtest() throws IOException {
		//管网编号
		String sql="update PTEM_ACDISTURB_TEST t set t.PIPENO=" +
				"(select t2.PIPESECTIONNO from PTEM_POINT_DRAINAGE t2 " +
				"where t2.DRAINAGECODE=t.EQUIPMENTCODE)";
		sql+=" where t.PIPENO is null";
		dbService.exeSql(sql);
		//坐标Y
		sql="update PTEM_ACDISTURB_TEST t set t.LOCATIONY=" +
		"(select t2.LOCATIONY from PTEM_POINT_DRAINAGE t2 " +
		"where t2.DRAINAGECODE=t.EQUIPMENTCODE)";
		sql+=" where t.LOCATIONY is null";
		dbService.exeSql(sql);
		//坐标X
		sql="update PTEM_ACDISTURB_TEST t set t.LOCATIONX=" +
		"(select t2.LOCATIONX from PTEM_POINT_DRAINAGE t2 " +
		"where t2.DRAINAGECODE=t.EQUIPMENTCODE)";
		sql+=" where t.LOCATIONX is null";
		dbService.exeSql(sql);
		//经纬度
		updatePointLB("PTEM_ACDISTURB_TEST", "longitude", "latitude",
				"locationx", "locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_ACDISTURB_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	
	//表5-11-2 交流干扰防护系统检测部分
	public void updateAcdisturbtest(String ids) throws IOException {
		//管网编号
		String sql="update PTEM_ACDISTURB_TEST t set t.PIPENO=" +
				"(select t2.PIPESECTIONNO from PTEM_POINT_DRAINAGE t2 " +
				"where t2.DRAINAGECODE=t.EQUIPMENTCODE)";
		sql+=" where t.PIPENO is null";
		sql+=" and t.id in("+ids+")";
		dbService.exeSql(sql);
		//坐标Y
		sql="update PTEM_ACDISTURB_TEST t set t.LOCATIONY=" +
		"(select t2.LOCATIONY from PTEM_POINT_DRAINAGE t2 " +
		"where t2.DRAINAGECODE=t.EQUIPMENTCODE)";
		sql+=" where t.LOCATIONY is null";
		sql+=" and t.id in("+ids+")";
		dbService.exeSql(sql);
		//坐标X
		sql="update PTEM_ACDISTURB_TEST t set t.LOCATIONX=" +
		"(select t2.LOCATIONX from PTEM_POINT_DRAINAGE t2 " +
		"where t2.DRAINAGECODE=t.EQUIPMENTCODE)";
		sql+=" where t.LOCATIONX is null";
		sql+=" and t.id in("+ids+")";
		dbService.exeSql(sql);
		//经纬度
		updatePointLB("PTEM_ACDISTURB_TEST", "longitude", "latitude",
				"locationx", "locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_ACDISTURB_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}
	
	// 表5-12 腐蚀防护系统评价字段
	public void updateDefendEvaluateField(String id,String pipelineno,String desField,
			String srcField,String srcTable) throws IOException {
		String sql="select t."+srcField+" from "+srcTable+" t " +
		"where t.PIPELINENO='"+pipelineno+"' and t."+srcField+
		" is not null order by (cast(t.id as int)) desc";
		List<String> listT=dbService.queryDataBySql(sql);
		if(listT.size()!=0)
		{
			String value=listT.get(0);
			sql="update PTEM_DEFEND_EVALUATE t set t."+desField+"='"+value+"'";
			sql+="where t.id='"+id+"' and t."+desField+" is null";
			dbService.exeSql(sql);
		}
	}
	
	public void updateDefendEvaluateFields() throws IOException {
		String sql="";
		sql="select t.id,t.pipelineno from PTEM_DEFEND_EVALUATE t where t.pipelineno is not null";
		List<Object[]> list=dbService.queryDataBySql(sql);
		int size=list.size();
		for(int i=0;i<size;i++)
		{
			Object[] objs=list.get(i);
			String id=objs[0].toString();
			String pipelineno="";
			String pipeno="";			
			pipelineno=objs[1].toString();
			//土壤腐蚀性等级	"根据管线编号取表5-1“土壤腐蚀性评价” 注：后期系统升级应调取表5-1“土壤腐蚀性等级”"			
			updateDefendEvaluateField(id,pipelineno,"SOILCORROSIONLEVEL","SOILCORROSIONEVALUATE","PTEM_SOILCORROSION");
			//直流干扰程度	根据管线编号取表5-2“直流干扰程度”
			updateDefendEvaluateField(id,pipelineno,"CURRENTDISTURB","CURRENTDISTURBLEVEL","PTEM_STRAYCURRENTTEST_DATA");
			//交流干扰程度	根据管线编号取表5-2“交流干扰程度”
			updateDefendEvaluateField(id,pipelineno,"ACDISTURB","ACDISTURBLEVEL","PTEM_STRAYCURRENTTEST_DATA");
			//外防腐层绝缘电阻(Rg值)	根据管线编号取表5-7“防腐层绝缘电阻Rg值”
			updateDefendEvaluateField(id,pipelineno,"COATINGRISO","RISOVALUE","PTEM_COATING_RISO_EVALUATE");			
			//电流衰减率（Y值）	根据管线编号取表5-7“电流衰减率（Y值）”
			updateDefendEvaluateField(id,pipelineno,"CURRENTDECAYRATE","CURRENTDECAYRATE","PTEM_COATING_RISO_EVALUATE");			
			//破损点密度（P值）	根据管线编号取表5-6中管线编号所包含的破损点总数除以表C中管网编号的实际长度总和。
			//updateDefendEvaluateField(pipelineno,"ACDISTURB","ACDISTURBLEVEL","PTEM_STRAYCURRENTTEST_DATA");			
		}
	}
	public void updateDefendEvaluateFields(String ids) throws IOException {
		String sql="";
		sql="select t.id,t.pipelineno from PTEM_DEFEND_EVALUATE t where t.pipelineno is not null";
		sql+=" and t.id in("+ids+")";
		List<Object[]> list=dbService.queryDataBySql(sql);
		int size=list.size();
		for(int i=0;i<size;i++)
		{
			Object[] objs=list.get(i);
			String id=objs[0].toString();
			String pipelineno="";
			String pipeno="";			
			pipelineno=objs[1].toString();
			//土壤腐蚀性等级	"根据管线编号取表5-1“土壤腐蚀性评价” 注：后期系统升级应调取表5-1“土壤腐蚀性等级”"			
			updateDefendEvaluateField(id,pipelineno,"SOILCORROSIONLEVEL","SOILCORROSIONEVALUATE","PTEM_SOILCORROSION");
			//直流干扰程度	根据管线编号取表5-2“直流干扰程度”
			updateDefendEvaluateField(id,pipelineno,"CURRENTDISTURB","CURRENTDISTURBLEVEL","PTEM_STRAYCURRENTTEST_DATA");
			//交流干扰程度	根据管线编号取表5-2“交流干扰程度”
			updateDefendEvaluateField(id,pipelineno,"ACDISTURB","ACDISTURBLEVEL","PTEM_STRAYCURRENTTEST_DATA");
			//外防腐层绝缘电阻(Rg值)	根据管线编号取表5-7“防腐层绝缘电阻Rg值”
			updateDefendEvaluateField(id,pipelineno,"COATINGRISO","RISOVALUE","PTEM_COATING_RISO_EVALUATE");			
			//电流衰减率（Y值）	根据管线编号取表5-7“电流衰减率（Y值）”
			updateDefendEvaluateField(id,pipelineno,"CURRENTDECAYRATE","CURRENTDECAYRATE","PTEM_COATING_RISO_EVALUATE");			
			//破损点密度（P值）	根据管线编号取表5-6中管线编号所包含的破损点总数除以表C中管网编号的实际长度总和。
			//updateDefendEvaluateField(pipelineno,"ACDISTURB","ACDISTURBLEVEL","PTEM_STRAYCURRENTTEST_DATA");			
		}
	}
	// 表5-12 腐蚀防护系统评价
	public void updateDefendEvaluate() throws IOException {
		//管网编号	自动填写表C中管线编号所含管网编号，若已填写，则不自动更新。
		updatePipenoFromSec("PTEM_DEFEND_EVALUATE");
		updateDefendEvaluateFields();
	}
	// 表5-12 腐蚀防护系统评价部分
	public void updateDefendEvaluate(String ids) throws IOException {
		//管网编号	自动填写表C中管线编号所含管网编号，若已填写，则不自动更新。
		updatePipenoFromSec("PTEM_DEFEND_EVALUATE",ids);
		updateDefendEvaluateFields(ids);
	}
	// 表6-1 外观检查
	public void updateApperancecheck() throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_APPERANCE_CHECK", "pipeno");
		// 经纬度
		updatePointLB("PTEM_APPERANCE_CHECK", "longitude", "latitude",
				"locationx", "locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_APPERANCE_CHECK", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	// 表6-1 外观检查部分
	public void updateApperancecheck(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_APPERANCE_CHECK", "pipeno",ids);
		// 经纬度
		updatePointLB("PTEM_APPERANCE_CHECK", "longitude", "latitude",
				"locationx", "locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_APPERANCE_CHECK", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}
	// 表6-2 壁厚检测
	public void updateWallthickness() throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_WALLTHICKNESS", "pipeno");
		// 经纬度
		updatePointLB("PTEM_WALLTHICKNESS", "longitude", "latitude",
				"locationx", "locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_WALLTHICKNESS", "longitude", "latitude",
				"longitude_map", "latitude_map");

	}
	// 表6-2 壁厚检测部分
	public void updateWallthickness(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_WALLTHICKNESS", "pipeno",ids);
		// 经纬度
		updatePointLB("PTEM_WALLTHICKNESS", "longitude", "latitude",
				"locationx", "locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_WALLTHICKNESS", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);

	}
	// 表6-3 防腐层厚度检测
	public void updateCoatingthickness() throws IOException {
		// 管网编号手动
//		updatePipeSectionNo("PTEM_COATINGTHICKNESS", "pipeno", "locationx",
//				"locationy");
		// 管线编号
		updatePipeLineNo("PTEM_COATINGTHICKNESS", "pipeno");
		// 防腐层类型
		String sql = "update PTEM_COATINGTHICKNESS t set t.COATINGTYPE ="
				+ "(select t2.COATINGTYPE from ptem_pipeline t2 "
				+ "where t2.pipelineno=t.pipelineno)";

		// 经纬度
		updatePointLB("PTEM_COATINGTHICKNESS", "longitude", "latitude",
				"locationx", "locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_COATINGTHICKNESS", "longitude", "latitude",
				"longitude_map", "latitude_map");

		dbService.exeSql(sql);
	}
	// 表6-3 防腐层厚度检测部分
	public void updateCoatingthickness(String ids) throws IOException {
		// 管网编号手动
//		updatePipeSectionNo("PTEM_COATINGTHICKNESS", "pipeno", "locationx",
//				"locationy");
		// 管线编号
		updatePipeLineNo("PTEM_COATINGTHICKNESS", "pipeno",ids);
		// 防腐层类型
		String sql = "update PTEM_COATINGTHICKNESS t set t.COATINGTYPE ="
				+ "(select t2.COATINGTYPE from ptem_pipeline t2 "
				+ "where t2.pipelineno=t.pipelineno)";
		sql+=" where t.id in("+ids+")";
		dbService.exeSql(sql);
		// 经纬度
		updatePointLB("PTEM_COATINGTHICKNESS", "longitude", "latitude",
				"locationx", "locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_COATINGTHICKNESS", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);

		dbService.exeSql(sql);
	}

	// 表6-4 防腐层破损检测
	public void updateCoatingdamagedtest() throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_COATINGDAMAGED_TEST", "pipeno");
		// 经纬度
		updatePointLB("PTEM_COATINGDAMAGED_TEST", "longitude", "latitude",
				"locationx", "locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_COATINGDAMAGED_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map");

	}
	// 表6-4 防腐层破损检测部分
	public void updateCoatingdamagedtest(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_COATINGDAMAGED_TEST", "pipeno",ids);
		// 经纬度
		updatePointLB("PTEM_COATINGDAMAGED_TEST", "longitude", "latitude",
				"locationx", "locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_COATINGDAMAGED_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);

	}
	// 表6-5 管体腐蚀状况检测
	public void updateCorrosiontest() throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_CORROSION_TEST", "pipeno");
		// 经纬度
		updatePointLB("PTEM_CORROSION_TEST", "longitude", "latitude",
				"locationx", "locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_CORROSION_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	// 表6-5 管体腐蚀状况检测部分
	public void updateCorrosiontest(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_CORROSION_TEST", "pipeno",ids);
		// 经纬度
		updatePointLB("PTEM_CORROSION_TEST", "longitude", "latitude",
				"locationx", "locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_CORROSION_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}
	// 表6-6 射线检测
	public void updateRadial() throws IOException {
		// 管网编号
		updatePipeSectionNo("PTEM_RADIAL", "pipeno", "locationx", "locationy");
		// 管线编号
		updatePipeLineNo("PTEM_RADIAL", "pipeno");
		// 经纬度
		updatePointLB("PTEM_RADIAL", "longitude", "latitude", "locationx",
				"locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_RADIAL", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	// 表6-6 射线检测部分
	public void updateRadial(String ids) throws IOException {
		// 管网编号
		updatePipeSectionNo("PTEM_RADIAL", "pipeno", "locationx", "locationy",ids);
		// 管线编号
		updatePipeLineNo("PTEM_RADIAL", "pipeno",ids);
		// 经纬度
		updatePointLB("PTEM_RADIAL", "longitude", "latitude", "locationx",
				"locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_RADIAL", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}
	// 更新表7-1 化学成分分析
	public void updateChemical() throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_CHEMICAL", "pipeno");
		// 经纬度
		updatePointLB("PTEM_CHEMICAL", "longitude", "latitude", "locationx",
				"locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_CHEMICAL", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	// 更新表7-1 化学成分分析部分
	public void updateChemical(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_CHEMICAL", "pipeno",ids);
		// 经纬度
		updatePointLB("PTEM_CHEMICAL", "longitude", "latitude", "locationx",
				"locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_CHEMICAL", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}
	// 表7-2 硬度测试
	public void updateHardness() throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_HARDNESS", "pipeno");
		// 经纬度
		updatePointLB("PTEM_HARDNESS", "longitude", "latitude", "locationx",
				"locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_HARDNESS", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	// 表7-2 硬度测试部分
	public void updateHardness(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_HARDNESS", "pipeno",ids);
		// 经纬度
		updatePointLB("PTEM_HARDNESS", "longitude", "latitude", "locationx",
				"locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_HARDNESS", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}

	// 7-3 金相分析
	public void updateMetallographic() throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_METALLOGRAPHIC", "pipeno");
		// 经纬度
		updatePointLB("PTEM_METALLOGRAPHIC", "longitude", "latitude",
				"locationx", "locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_METALLOGRAPHIC", "longitude", "latitude",
				"longitude_map", "latitude_map");

	}
	// 7-3 金相分析部分
	public void updateMetallographic(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_METALLOGRAPHIC", "pipeno",ids);
		// 经纬度
		updatePointLB("PTEM_METALLOGRAPHIC", "longitude", "latitude",
				"locationx", "locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_METALLOGRAPHIC", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);

	}
	// 表7-4 拉伸试验
	public void updateStretch() throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_STRETCH", "pipeno");
		// 经纬度
		updatePointLB("PTEM_STRETCH", "longitude", "latitude", "locationx",
				"locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_STRETCH", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	// 表7-4 拉伸试验部分
	public void updateStretch(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_STRETCH", "pipeno",ids);
		// 经纬度
		updatePointLB("PTEM_STRETCH", "longitude", "latitude", "locationx",
				"locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_STRETCH", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}
	// 表7-5 弯曲试验
	public void updateBend() throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_BEND", "pipeno");
		// 经纬度
		updatePointLB("PTEM_BEND", "longitude", "latitude", "locationx",
				"locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_BEND", "longitude", "latitude", "longitude_map",
				"latitude_map");
	}
	// 表7-5 弯曲试验部分
	public void updateBend(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_BEND", "pipeno",ids);
		// 经纬度
		updatePointLB("PTEM_BEND", "longitude", "latitude", "locationx",
				"locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_BEND", "longitude", "latitude", "longitude_map",
				"latitude_map",ids);
	}
	// 表7-6 冲击试验
	public void updateShock() throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_SHOCK", "pipeno");
		// 经纬度
		updatePointLB("PTEM_SHOCK", "longitude", "latitude", "locationx",
				"locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_SHOCK", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	// 表7-6 冲击试验部分
	public void updateShock(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_SHOCK", "pipeno",ids);
		// 经纬度
		updatePointLB("PTEM_SHOCK", "longitude", "latitude", "locationx",
				"locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_SHOCK", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}
	// 表7-7 残余应力测试
	public void updateRemainingstress() throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_REMAININGSTRESS", "pipeno");
		// 经纬度
		updatePointLB("PTEM_REMAININGSTRESS", "longitude", "latitude",
				"locationx", "locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_REMAININGSTRESS", "longitude", "latitude",
				"longitude_map", "latitude_map");

	}
	// 表7-7 残余应力测试部分
	public void updateRemainingstress(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_REMAININGSTRESS", "pipeno",ids);
		// 经纬度
		updatePointLB("PTEM_REMAININGSTRESS", "longitude", "latitude",
				"locationx", "locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_REMAININGSTRESS", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}
	// 表8-1 导波检测
	public void updateGuidewavestest() throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_GUIDEDWAVES_TEST", "pipeno");
		// 经纬度
		updatePointLB("PTEM_GUIDEDWAVES_TEST", "longitude", "latitude",
				"locationx", "locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_GUIDEDWAVES_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	// 表8-1 导波检测部分
	public void updateGuidewavestest(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_GUIDEDWAVES_TEST", "pipeno",ids);
		// 经纬度
		updatePointLB("PTEM_GUIDEDWAVES_TEST", "longitude", "latitude",
				"locationx", "locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_GUIDEDWAVES_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}
	// 表8-2 磁记忆应力检测
	public void updateMagnetictest() throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_MAGNETIC_TEST", "pipeno");
		// 经纬度
		updatePointLB("PTEM_MAGNETIC_TEST", "longitude", "latitude",
				"locationx", "locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_MAGNETIC_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	// 表8-2 磁记忆应力检测部分
	public void updateMagnetictest(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_MAGNETIC_TEST", "pipeno",ids);
		// 经纬度
		updatePointLB("PTEM_MAGNETIC_TEST", "longitude", "latitude",
				"locationx", "locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_MAGNETIC_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}
	// 表8-3 瞬变电磁检测
	public void updateTdemtest() throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_TDEM_TEST", "pipeno");
		// 经纬度
		updatePointLB("PTEM_TDEM_TEST", "longitude", "latitude", "locationx",
				"locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_TDEM_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	// 表8-3 瞬变电磁检测部分
	public void updateTdemtest(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_TDEM_TEST", "pipeno",ids);
		// 经纬度
		updatePointLB("PTEM_TDEM_TEST", "longitude", "latitude", "locationx",
				"locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_TDEM_TEST", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}
	// 更新表8-4 安全阀校验
	public void updateSafetyvalveVerify() throws IOException {
		// 从表E获取的字段
		String sql="";
		// 位置编号改为手动
//		String sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.LOCATIONNO="
//				+ "(select t2.LOCATIONNO from PTEM_STATION t2 "
//				+ "where t2.PIPENO=(select t3.PIPENETNO from PTEM_SAFETYVALVE t3 "
//				+ "where t3.SAFETYVALVENO=t1.SAFETYVALVENO)) where t1.LOCATIONNO is null";
//		dbService.exeSql(sql);
		// 位置描述改为手动 
//		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.LOCATIONDESCRIPTION="
//				+ "(select t2.LOCATIONDESCRIPTION from PTEM_STATION t2 "
//				+ "where t2.PIPENO=(select t3.PIPENETNO from PTEM_SAFETYVALVE t3 "
//				+ "where t3.SAFETYVALVENO=t1.SAFETYVALVENO)) where t1.LOCATIONDESCRIPTION is null";
//		dbService.exeSql(sql);
		// 从表E-2获取的字段
		// 设备代码
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.DEVICECODE="
				+ "(select t2.DEVICECODE from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.DEVICECODE is null";
		dbService.exeSql(sql);
		// 安全阀型号
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.SAFETYVALVEMODEL="
				+ "(select t2.SAFETYVALVEMODEL from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.SAFETYVALVEMODEL is null";
		dbService.exeSql(sql);
		// 公称通径/阀座口径（mm）
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.NOMINALDIAMETER="
				+ "(select t2.NOMINALDIAMETER from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.NOMINALDIAMETER is null";
		dbService.exeSql(sql);
		// 安全阀类型
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.SAFETYVALVETYPE="
				+ "(select t2.SAFETYVALVETYPE from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.SAFETYVALVETYPE is null";
		dbService.exeSql(sql);
		// 压力级别范围
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.PRESSURECLASSRANGE="
				+ "(select t2.PRESSURECLASSRANGE from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.PRESSURECLASSRANGE is null";

		// sql="update PTEM_SAFETYVALVE_VERIFY t1 set t1.PRESSURECLASSRANGE=" +
		// "(select t2.PRESSURECLASSRANGE from PTEM_SAFETYVALVE t2 " +
		// "where t2.SAFETYVALVENO=t1.SAFETYVALVENO)";
		dbService.exeSql(sql);
		// 制造单位
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.MANUFACTURER="
				+ "(select t2.MANUFACTURER from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.MANUFACTURER is null";

		// sql="update PTEM_SAFETYVALVE_VERIFY t1 set t1.MANUFACTURER=" +
		// "(select t2.MANUFACTURER from PTEM_SAFETYVALVE t2 " +
		// "where t2.SAFETYVALVENO=t1.SAFETYVALVENO)";
		dbService.exeSql(sql);
		// 制造许可证编号
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.LICENSENO="
				+ "(select t2.LICENSENO from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.LICENSENO is null";

		// sql="update PTEM_SAFETYVALVE_VERIFY t1 set t1.LICENSENO=" +
		// "(select t2.LICENSENO from PTEM_SAFETYVALVE t2 " +
		// "where t2.SAFETYVALVENO=t1.SAFETYVALVENO)";
		dbService.exeSql(sql);
		// 出厂日期
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.FACTORYDATE="
				+ "(select t2.FACTORYDATE from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.FACTORYDATE is null";

		// sql="update PTEM_SAFETYVALVE_VERIFY t1 set t1.FACTORYDATE=" +
		// "(select t2.FACTORYDATE from PTEM_SAFETYVALVE t2 " +
		// "where t2.SAFETYVALVENO=t1.SAFETYVALVENO)";
		dbService.exeSql(sql);
		// 管理单位
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.MANAGEUNIT="
				+ "(select t2.MANAGEUNIT from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.MANAGEUNIT is null";

		// sql="update PTEM_SAFETYVALVE_VERIFY t1 set t1.MANAGEUNIT=" +
		// "(select t2.MANAGEUNIT from PTEM_SAFETYVALVE t2 " +
		// "where t2.SAFETYVALVENO=t1.SAFETYVALVENO)";
		dbService.exeSql(sql);
		// 管理部门
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.MANAGEDEPARMENT="
				+ "(select t2.MANAGEDEPARMENT from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.MANAGEDEPARMENT is null";

		// sql="update PTEM_SAFETYVALVE_VERIFY t1 set t1.MANAGEDEPARMENT=" +
		// "(select t2.MANAGEDEPARMENT from PTEM_SAFETYVALVE t2 " +
		// "where t2.SAFETYVALVENO=t1.SAFETYVALVENO)";
		dbService.exeSql(sql);
		// 整定压力
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.SETPRESSURE=t1.REQUIREDSETPRESSURE "
				+ " where t1.SETPRESSURE is null";
		// sql="update PTEM_SAFETYVALVE_VERIFY t1 set
		// t1.SETPRESSURE=t1.REQUIREDSETPRESSURE";
		dbService.exeSql(sql);
		// 下次校验日期
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.NEXTVERIFYDATE=ADD_MONTHS(t1.TESTDATE,12)-1 "
				+ " where t1.NEXTVERIFYDATE is null";
		// sql="update PTEM_SAFETYVALVE_VERIFY t1 set
		// t1.NEXTVERIFYDATE=ADD_MONTHS(t1.TESTDATE,12)-1";
		dbService.exeSql(sql);
	}
	// 更新表8-4 安全阀校验部分
	public void updateSafetyvalveVerify(String ids) throws IOException {
		// 从表E获取的字段
		String sql="";
		// 位置编号改为手动
//		String sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.LOCATIONNO="
//				+ "(select t2.LOCATIONNO from PTEM_STATION t2 "
//				+ "where t2.PIPENO=(select t3.PIPENETNO from PTEM_SAFETYVALVE t3 "
//				+ "where t3.SAFETYVALVENO=t1.SAFETYVALVENO)) where t1.LOCATIONNO is null";
//		dbService.exeSql(sql);
		// 位置描述改为手动 
//		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.LOCATIONDESCRIPTION="
//				+ "(select t2.LOCATIONDESCRIPTION from PTEM_STATION t2 "
//				+ "where t2.PIPENO=(select t3.PIPENETNO from PTEM_SAFETYVALVE t3 "
//				+ "where t3.SAFETYVALVENO=t1.SAFETYVALVENO)) where t1.LOCATIONDESCRIPTION is null";
//		dbService.exeSql(sql);
		// 从表E-2获取的字段
		// 设备代码
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.DEVICECODE="
				+ "(select t2.DEVICECODE from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.DEVICECODE is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
		// 安全阀型号
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.SAFETYVALVEMODEL="
				+ "(select t2.SAFETYVALVEMODEL from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.SAFETYVALVEMODEL is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
		// 公称通径/阀座口径（mm）
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.NOMINALDIAMETER="
				+ "(select t2.NOMINALDIAMETER from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.NOMINALDIAMETER is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
		// 安全阀类型
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.SAFETYVALVETYPE="
				+ "(select t2.SAFETYVALVETYPE from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.SAFETYVALVETYPE is null";
		sql+=" and t1.id in("+ids+")";
		dbService.exeSql(sql);
		// 压力级别范围
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.PRESSURECLASSRANGE="
				+ "(select t2.PRESSURECLASSRANGE from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.PRESSURECLASSRANGE is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update PTEM_SAFETYVALVE_VERIFY t1 set t1.PRESSURECLASSRANGE=" +
		// "(select t2.PRESSURECLASSRANGE from PTEM_SAFETYVALVE t2 " +
		// "where t2.SAFETYVALVENO=t1.SAFETYVALVENO)";
		dbService.exeSql(sql);
		// 制造单位
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.MANUFACTURER="
				+ "(select t2.MANUFACTURER from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.MANUFACTURER is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update PTEM_SAFETYVALVE_VERIFY t1 set t1.MANUFACTURER=" +
		// "(select t2.MANUFACTURER from PTEM_SAFETYVALVE t2 " +
		// "where t2.SAFETYVALVENO=t1.SAFETYVALVENO)";
		dbService.exeSql(sql);
		// 制造许可证编号
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.LICENSENO="
				+ "(select t2.LICENSENO from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.LICENSENO is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update PTEM_SAFETYVALVE_VERIFY t1 set t1.LICENSENO=" +
		// "(select t2.LICENSENO from PTEM_SAFETYVALVE t2 " +
		// "where t2.SAFETYVALVENO=t1.SAFETYVALVENO)";
		dbService.exeSql(sql);
		// 出厂日期
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.FACTORYDATE="
				+ "(select t2.FACTORYDATE from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.FACTORYDATE is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update PTEM_SAFETYVALVE_VERIFY t1 set t1.FACTORYDATE=" +
		// "(select t2.FACTORYDATE from PTEM_SAFETYVALVE t2 " +
		// "where t2.SAFETYVALVENO=t1.SAFETYVALVENO)";
		dbService.exeSql(sql);
		// 管理单位
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.MANAGEUNIT="
				+ "(select t2.MANAGEUNIT from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.MANAGEUNIT is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update PTEM_SAFETYVALVE_VERIFY t1 set t1.MANAGEUNIT=" +
		// "(select t2.MANAGEUNIT from PTEM_SAFETYVALVE t2 " +
		// "where t2.SAFETYVALVENO=t1.SAFETYVALVENO)";
		dbService.exeSql(sql);
		// 管理部门
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.MANAGEDEPARMENT="
				+ "(select t2.MANAGEDEPARMENT from PTEM_SAFETYVALVE t2 "
				+ "where t2.SAFETYVALVENO=t1.SAFETYVALVENO) where t1.MANAGEDEPARMENT is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update PTEM_SAFETYVALVE_VERIFY t1 set t1.MANAGEDEPARMENT=" +
		// "(select t2.MANAGEDEPARMENT from PTEM_SAFETYVALVE t2 " +
		// "where t2.SAFETYVALVENO=t1.SAFETYVALVENO)";
		dbService.exeSql(sql);
		// 整定压力
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.SETPRESSURE=t1.REQUIREDSETPRESSURE "
				+ " where t1.SETPRESSURE is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update PTEM_SAFETYVALVE_VERIFY t1 set
		// t1.SETPRESSURE=t1.REQUIREDSETPRESSURE";
		dbService.exeSql(sql);
		// 下次校验日期
		sql = "update PTEM_SAFETYVALVE_VERIFY t1 set t1.NEXTVERIFYDATE=ADD_MONTHS(t1.TESTDATE,12)-1 "
				+ " where t1.NEXTVERIFYDATE is null";
		sql+=" and t1.id in("+ids+")";
		// sql="update PTEM_SAFETYVALVE_VERIFY t1 set
		// t1.NEXTVERIFYDATE=ADD_MONTHS(t1.TESTDATE,12)-1";
		dbService.exeSql(sql);
	}

	// 表9-2 合于使用评价报告
	public void updateFitnessassess() throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_FITNESS_ASSESS", "pipeno");
		// 经纬度
		updatePointLB("PTEM_FITNESS_ASSESS", "longitude", "latitude",
				"locationx", "locationy");
		// 地图经纬度
		updatePointLBMap("PTEM_FITNESS_ASSESS", "longitude", "latitude",
				"longitude_map", "latitude_map");
	}
	// 表9-2 合于使用评价报告
	public void updateFitnessassess(String ids) throws IOException {
		// 管线编号
		updatePipeLineNo("PTEM_FITNESS_ASSESS", "pipeno",ids);
		// 经纬度
		updatePointLB("PTEM_FITNESS_ASSESS", "longitude", "latitude",
				"locationx", "locationy",ids);
		// 地图经纬度
		updatePointLBMap("PTEM_FITNESS_ASSESS", "longitude", "latitude",
				"longitude_map", "latitude_map",ids);
	}

	// 更新数据库数据一个表的所有记录
	public String updateDBDataAllRecords(String tablename) throws IOException {
		String res;
		if (tablename.equals("PTEM_PROJECT_INFO")) // 表A工程项目信息
		{
			updateProjectInfo();
		}
		if (tablename.equals("PTEM_PIPELINE")) // 表B管线
		{
			res=updatePipeLine();
			return res;
		}
		if (tablename.equals("PTEM_PIPESECTION")) // 表C管段
		{
			updatePipeSection();
		}
		if (tablename.equals("PTEM_PIPEPOINT")) // 表C-1特征点
		{
			updatePipePoint();
		}
		if (tablename.equals("PTEM_POINT_TEE")) // 表C-2三通
		{
			updatePointTee();
		}
		if (tablename.equals("PTEM_POINT_ANODE")) // 表C-3阳极
		{
			updatePointAnode();
		}
		if (tablename.equals("PTEM_POINT_POLE")) // 表C-4测试桩
		{
			updatePointPole();
		}
		if (tablename.equals("PTEM_POINT_DRAINAGE")) // 表C-5排流装置
		{
			updatePointDrainage();
		}
		if (tablename.equals("PTEM_POINT_CROSSING")) // 表C-6穿跨越
		{
			updatePointCrossing();
		}
		if (tablename.equals("PTEM_POINT_CASING")) // 表C-7套管
		{
			updatePointCasing();
		}
		if (tablename.equals("PTEM_POINT_BEND")) // 表C-8弯管
		{
			updatePointBend();
		}
		if (tablename.equals("PTEM_POINT_LINER")) // 表C-9内衬
		{
			updatePointLiner();
		}
		if (tablename.equals("PTEM_VALVE")) // 表D阀门
		{
			updateValve();
		}
		if (tablename.equals("PTEM_STATION")) // 表E站箱
		{
			updateStation();
		}
		if (tablename.equals("PTEM_FILTER")) // 表E-1过滤器
		{
			updateFilter();
		}
		if (tablename.equals("PTEM_SAFETYVALVE")) // 表E-2安全阀
		{
			updateSafetyValve();
		}
		if (tablename.equals("PTEM_EXCEPTION")) // 表F-1异常
		{
			updateException();
		}
		if (tablename.equals("PTEM_SPECIAL")) // 表F-2特殊段
		{
			updateSpecial();
		}
		if (tablename.equals("PTEM_VIOLATION")) // 表F-3 违章占压
		{
			updateViolation();
		}
		if (tablename.equals("PTEM_EMERGENCY")) // 表G 应急事件
		{
			updateEmergency();
		}
		if (tablename.equals("PTEM_LEAKPOINT")) // 表G-1 泄漏点
		{
			updateLeakpoint();
		}
		if (tablename.equals("PTEM_OPERATIONS")) // 表H 生产作业
		{
			updateOperations();
		}
		if (tablename.equals("PTEM_FITTING")) // 表H-1 带气作业机械预制件（Fitting）
		{
			updateFilting();
		}
		if (tablename.equals("PTEM_TEST_SUMMARY")) // 表2 检验汇总
		{
			updateTestSummary();
		}
		if (tablename.equals("PTEM_MATERIALS_REVIEW")) //表3资料审查
		{
			updateMaterialReview();
		}
		if (tablename.equals("PTEM_MACRO_TEST")) //表4宏观检查
		{
			updateMacrotest();
		}
		if (tablename.equals("PTEM_POINT_TEST")) //表4-1 特征点检测
		{
			updatePointtest();
		}
		if (tablename.equals("PTEM_CROSSING_TEST")) //表4-2穿跨越检测
		{
			updateCrossingTest();
		}
		if (tablename.equals("PTEM_LEAK_TEST")) //表4-3 泄漏检测
		{
			updateLeakTest();
		}
		if (tablename.equals("PTEM_SOILCORROSION")) //表5-1 土壤腐蚀性检测
		{
			updateSoilcorrosion();
		}
		if (tablename.equals("PTEM_STRAYCURRENTTEST")) //表5-2 杂散电流检测
		{
			updateStraycurrenttest();
		}
		if (tablename.equals("PTEM_RISOTEST_PCM")) //表5-3 防腐层绝缘电阻检测PCM
		{
			updateRisotestpcm();
		}
		if (tablename.equals("PTEM_RISOTESTCSCAN")) //表5-4 防腐层绝缘电阻检测C扫描
		{
			updateRisotestcscan();
		}
		if (tablename.equals("PTEM_RISOTESTPEARSON")) //表5-5 防腐层绝缘电阻检测PEARSON
		{
			updateRisotestpearson();
		}
		if (tablename.equals("PTEM_COATING_DAMAGEDPOINT")) //表5-6 防腐层破损点
		{
			updateCoatingDamagedpoint();
		}
		if (tablename.equals("PTEM_COATING_RISO_EVALUATE")) //表5-7 防腐层绝缘电阻评估
		{
			updateCoatingRisoEvaluate();
		}
		if (tablename.equals("PTEM_TESTPILEINSPECT")) //表5-8 测试桩检测
		{
			updateTestPileinspect();
		}
		if (tablename.equals("PTEM_CIPS_TEST")) //表5-9 阴极保护CIPS检测
		{
			updateCIPSTest();
		}
		if (tablename.equals("PTEM_CP_EVALUATE")) //表5-10 阴极保护效果评估
		{
			updateCPEvaluate();
		}
		if (tablename.equals("PTEM_CURRENTDISTURB_TEST")) //表5-11 排流装置检测
		{
			updateCurrentdisturbtest();
		}
		if (tablename.equals("PTEM_ACDISTURB_TEST")) //表5-11-2 交流干扰防护系统检测
		{
			updateAcdisturbtest();
		}
		if (tablename.equals("PTEM_DEFEND_EVALUATE")) //表5-12 腐蚀防护系统评价
		{
			updateDefendEvaluate();
		}			
		if (tablename.equals("PTEM_APPERANCE_CHECK")) //表6-1 外观检查
		{
			updateApperancecheck();
		}
		if (tablename.equals("PTEM_WALLTHICKNESS")) //表6-2 壁厚检测
		{
			updateWallthickness();
		}
		if (tablename.equals("PTEM_COATINGTHICKNESS")) //表6-3 防腐层厚度检测
		{
			updateCoatingthickness();
		}
		if (tablename.equals("PTEM_COATINGDAMAGED_TEST")) //表6-4 防腐层破损检测
		{
			updateCoatingdamagedtest();
		}
		if (tablename.equals("PTEM_CORROSION_TEST")) //表6-5 管体腐蚀状况检测
		{
			updateCorrosiontest();
		}
		if (tablename.equals("PTEM_RADIAL")) //表6-6 射线检测
		{
			updateRadial();
		}
		if (tablename.equals("PTEM_CHEMICAL")) //表7-1 化学成分分析
		{
			updateChemical();
		}
		if (tablename.equals("PTEM_HARDNESS")) //表7-2 硬度测试
		{
			updateHardness();
		}
		if (tablename.equals("PTEM_METALLOGRAPHIC")) //7-3 金相分析
		{
			updateMetallographic();
		}
		if (tablename.equals("PTEM_STRETCH")) //表7-4 拉伸试验
		{
			updateStretch();
		}
		if (tablename.equals("PTEM_BEND")) //表7-5 弯曲试验
		{
			updateBend();
		}
		if (tablename.equals("PTEM_SHOCK")) //表7-6 冲击试验
		{
			updateShock();
		}
		if (tablename.equals("PTEM_REMAININGSTRESS")) //表7-7 残余应力测试
		{
			updateRemainingstress();
		}
		if (tablename.equals("PTEM_GUIDEDWAVES_TEST")) //表8-1 导波检测
		{
			updateGuidewavestest();
		}
		if (tablename.equals("PTEM_MAGNETIC_TEST")) //表8-2 磁记忆应力检测
		{
			updateMagnetictest();
		}
		if (tablename.equals("PTEM_TDEM_TEST")) //表8-3 瞬变电磁检测
		{
			updateTdemtest();
		}
		if (tablename.equals("PTEM_SAFETYVALVE_VERIFY")) //表8-4 安全阀校验
		{
			updateSafetyvalveVerify();
		}
		if (tablename.equals("PTEM_FITNESS_ASSESS")) //表9-2 合于使用评价报告
		{
			updateFitnessassess();
		}
		return "success";
	}
	// 更新数据库数据一个表的所选记录
	public String updateDBDataSelectedRecords(String tablename,String ids) throws IOException {
		String res="success";
		if (tablename.equals("PTEM_PROJECT_INFO")) // 表A工程项目信息
		{
			updateProjectInfo(ids);
		}
		if (tablename.equals("PTEM_PIPELINE")) // 表B管线
		{
			res=updatePipeLine(ids);
			
		}
		if (tablename.equals("PTEM_PIPESECTION")) // 表C管段
		{
			updatePipeSection(ids);
		}
		if (tablename.equals("PTEM_PIPEPOINT")) // 表C-1特征点
		{
			updatePipePoint(ids);
		}
		if (tablename.equals("PTEM_POINT_TEE")) // 表C-2三通
		{
			updatePointTee(ids);
		}
		if (tablename.equals("PTEM_POINT_ANODE")) // 表C-3阳极
		{
			updatePointAnode(ids);
		}
		if (tablename.equals("PTEM_POINT_POLE")) // 表C-4测试桩
		{
			updatePointPole(ids);
		}
		if (tablename.equals("PTEM_POINT_DRAINAGE")) // 表C-5排流装置
		{
			updatePointDrainage(ids);
		}
		if (tablename.equals("PTEM_POINT_CROSSING")) // 表C-6穿跨越
		{
			updatePointCrossing(ids);
		}
		if (tablename.equals("PTEM_POINT_CASING")) // 表C-7套管
		{
			updatePointCasing(ids);
		}
		if (tablename.equals("PTEM_POINT_BEND")) // 表C-8弯管
		{
			updatePointBend(ids);
		}
		if (tablename.equals("PTEM_POINT_LINER")) // 表C-9内衬
		{
			updatePointLiner(ids);
		}
		if (tablename.equals("PTEM_VALVE")) // 表D阀门
		{
			updateValve(ids);
		}
		if (tablename.equals("PTEM_STATION")) // 表E站箱
		{
			updateStation(ids);
		}
		if (tablename.equals("PTEM_FILTER")) // 表E-1过滤器
		{
			updateFilter(ids);
		}
		if (tablename.equals("PTEM_SAFETYVALVE")) // 表E-2安全阀
		{
			updateSafetyValve(ids);
		}
		if (tablename.equals("PTEM_EXCEPTION")) // 表F-1异常
		{
			updateException(ids);
		}
		if (tablename.equals("PTEM_SPECIAL")) // 表F-2特殊段
		{
			updateSpecial(ids);
		}
		if (tablename.equals("PTEM_VIOLATION")) // 表F-3 违章占压
		{
			updateViolation(ids);
		}
		if (tablename.equals("PTEM_EMERGENCY")) // 表G 应急事件
		{
			updateEmergency(ids);
		}
		if (tablename.equals("PTEM_LEAKPOINT")) // 表G-1 泄漏点
		{
			updateLeakpoint(ids);
		}
		if (tablename.equals("PTEM_OPERATIONS")) // 表H 生产作业
		{
			updateOperations(ids);
		}
		if (tablename.equals("PTEM_FITTING")) // 表H-1 带气作业机械预制件（Fitting）
		{
			updateFilting(ids);
		}
		if (tablename.equals("PTEM_TEST_SUMMARY")) // 表2 检验汇总
		{
			updateTestSummary(ids);
		}
		if (tablename.equals("PTEM_MATERIALS_REVIEW")) //表3资料审查
		{
			updateMaterialReview(ids);
		}
		if (tablename.equals("PTEM_MACRO_TEST")) //表4宏观检查
		{
			updateMacrotest(ids);
		}
		if (tablename.equals("PTEM_POINT_TEST")) //表4-1 特征点检测
		{
			updatePointtest(ids);
		}
		if (tablename.equals("PTEM_CROSSING_TEST")) //表4-2穿跨越检测
		{
			updateCrossingTest(ids);
		}
		if (tablename.equals("PTEM_LEAK_TEST")) //表4-3 泄漏检测
		{
			updateLeakTest(ids);
		}
		if (tablename.equals("PTEM_SOILCORROSION")) //表5-1 土壤腐蚀性检测
		{
			updateSoilcorrosion(ids);
		}
		if (tablename.equals("PTEM_STRAYCURRENTTEST")) //表5-2 杂散电流检测
		{
			updateStraycurrenttest(ids);
		}
		if (tablename.equals("PTEM_RISOTEST_PCM")) //表5-3 防腐层绝缘电阻检测PCM
		{
			updateRisotestpcm(ids);
		}
		if (tablename.equals("PTEM_RISOTESTCSCAN")) //表5-4 防腐层绝缘电阻检测C扫描
		{
			updateRisotestcscan(ids);
		}
		if (tablename.equals("PTEM_RISOTESTPEARSON")) //表5-5 防腐层绝缘电阻检测PEARSON
		{
			updateRisotestpearson(ids);
		}
		if (tablename.equals("PTEM_COATING_DAMAGEDPOINT")) //表5-6 防腐层破损点
		{
			updateCoatingDamagedpoint(ids);
		}
		if (tablename.equals("PTEM_COATING_RISO_EVALUATE")) //表5-7 防腐层绝缘电阻评估
		{
			updateCoatingRisoEvaluate(ids);
		}
		if (tablename.equals("PTEM_TESTPILEINSPECT")) //表5-8 测试桩检测
		{
			updateTestPileinspect(ids);
		}
		if (tablename.equals("PTEM_CIPS_TEST")) //表5-9 阴极保护CIPS检测
		{
			updateCIPSTest(ids);
		}
		if (tablename.equals("PTEM_CP_EVALUATE")) //表5-10 阴极保护效果评估
		{
			updateCPEvaluate(ids);
		}
		if (tablename.equals("PTEM_CURRENTDISTURB_TEST")) //表5-11 排流装置检测
		{
			updateCurrentdisturbtest(ids);
		}
		if (tablename.equals("PTEM_ACDISTURB_TEST")) //表5-11-2 交流干扰防护系统检测
		{
			updateAcdisturbtest(ids);
		}
		if (tablename.equals("PTEM_DEFEND_EVALUATE")) //表5-12 腐蚀防护系统评价
		{
			updateDefendEvaluate(ids);
		}			
		if (tablename.equals("PTEM_APPERANCE_CHECK")) //表6-1 外观检查
		{
			updateApperancecheck(ids);
		}
		if (tablename.equals("PTEM_WALLTHICKNESS")) //表6-2 壁厚检测
		{
			updateWallthickness(ids);
		}
		if (tablename.equals("PTEM_COATINGTHICKNESS")) //表6-3 防腐层厚度检测
		{
			updateCoatingthickness(ids);
		}
		if (tablename.equals("PTEM_COATINGDAMAGED_TEST")) //表6-4 防腐层破损检测
		{
			updateCoatingdamagedtest(ids);
		}
		if (tablename.equals("PTEM_CORROSION_TEST")) //表6-5 管体腐蚀状况检测
		{
			updateCorrosiontest(ids);
		}
		if (tablename.equals("PTEM_RADIAL")) //表6-6 射线检测
		{
			updateRadial(ids);
		}
		if (tablename.equals("PTEM_CHEMICAL")) //表7-1 化学成分分析
		{
			updateChemical(ids);
		}
		if (tablename.equals("PTEM_HARDNESS")) //表7-2 硬度测试
		{
			updateHardness(ids);
		}
		if (tablename.equals("PTEM_METALLOGRAPHIC")) //7-3 金相分析
		{
			updateMetallographic(ids);
		}
		if (tablename.equals("PTEM_STRETCH")) //表7-4 拉伸试验
		{
			updateStretch(ids);
		}
		if (tablename.equals("PTEM_BEND")) //表7-5 弯曲试验
		{
			updateBend(ids);
		}
		if (tablename.equals("PTEM_SHOCK")) //表7-6 冲击试验
		{
			updateShock(ids);
		}
		if (tablename.equals("PTEM_REMAININGSTRESS")) //表7-7 残余应力测试
		{
			updateRemainingstress(ids);
		}
		if (tablename.equals("PTEM_GUIDEDWAVES_TEST")) //表8-1 导波检测
		{
			updateGuidewavestest(ids);
		}
		if (tablename.equals("PTEM_MAGNETIC_TEST")) //表8-2 磁记忆应力检测
		{
			updateMagnetictest(ids);
		}
		if (tablename.equals("PTEM_TDEM_TEST")) //表8-3 瞬变电磁检测
		{
			updateTdemtest(ids);
		}
		if (tablename.equals("PTEM_SAFETYVALVE_VERIFY")) //表8-4 安全阀校验
		{
			updateSafetyvalveVerify(ids);
		}
		if (tablename.equals("PTEM_FITNESS_ASSESS")) //表9-2 合于使用评价报告
		{
			updateFitnessassess(ids);
		}
		return res;
	}
	// 更新数据库数据
	public void updateDBData() throws IOException {
		String formId = getRequest().getParameter("formId");
		String ids=getRequest().getParameter("ids");	
		String sql = "select t.FORM_EN_NAME from AUTO_FORMS_NEW t where t.id='";
		sql += formId;
		sql += "'";
		List<String> list = dbService.queryDataBySql(sql);
		String tablename = list.get(0);
		setContentType();
		PrintWriter out = getResponse().getWriter();
		String res="success";
		try {
			if(ids==null||ids=="")
			{
				res=updateDBDataAllRecords(tablename);
			}
			else
			{
				res=updateDBDataSelectedRecords(tablename,ids);
			}
			//out.print("{\"result\":\"success\"}");
			String msg="{\"result\":\""+res+"\"}";
			out.print(msg);
		} catch (Exception e) {
			e.printStackTrace();
			res=e.getMessage();
			String msg="{\"result\":\""+res+"\"}";
			out.print(msg);
		}
	}

	public void updateDBDataAll() throws IOException {
		setContentType();
		PrintWriter out = getResponse().getWriter();
		try {
			//更新测试桩表
			updatePointPole();
			//更新特征点表的管段编号
			//updatePipeSectionNoAll();
			//更新管段表
			//updatePipeSection();
			//更新管线表
			//updatePipeLine();
			//更新表4-2穿跨越检测
			//updateCrossingTest();
			//更新表3
			//updateMaterialReview();			
			//转换表5-9中的经纬度
			//convertLongitudeLatitude();
			//更新各表中的编号
			//updatePointNoAll();
			//更新字典表
			//updateDictionaryTable();
			//更新管线编号
			//updatePipeLineNo();
			//更新管线坐标
			//updatePipeLineCoord();			
			out.print("{\"result\":\"success\"}");
		} catch (Exception e) {
			e.printStackTrace();
			out.print("{\"result\":\"error\"}");
		}
	}

}
